mirror of
https://github.com/jlu5/PyLink.git
synced 2025-01-25 19:54:25 +01:00
clientbot: split up join() and handle_join() to prevent duplicate JOIN/MODE/WHO on connect
This commit is contained in:
parent
81f3112d01
commit
6981869c06
@ -161,8 +161,6 @@ class ClientbotWrapperProtocol(IRCCommonProtocol):
|
|||||||
# rely on the /NAMES reply to sync it up properly.
|
# rely on the /NAMES reply to sync it up properly.
|
||||||
if self.pseudoclient and client == self.pseudoclient.uid:
|
if self.pseudoclient and client == self.pseudoclient.uid:
|
||||||
self.send('JOIN %s' % channel)
|
self.send('JOIN %s' % channel)
|
||||||
self.send('MODE %s' % channel)
|
|
||||||
self._send_who(channel)
|
|
||||||
else:
|
else:
|
||||||
self.channels[channel].users.add(client)
|
self.channels[channel].users.add(client)
|
||||||
self.users[client].channels.add(channel)
|
self.users[client].channels.add(channel)
|
||||||
@ -820,12 +818,21 @@ class ClientbotWrapperProtocol(IRCCommonProtocol):
|
|||||||
|
|
||||||
def handle_join(self, source, command, args):
|
def handle_join(self, source, command, args):
|
||||||
"""
|
"""
|
||||||
Handles incoming JOINs.
|
Handles incoming JOINs, as well as JOIN acknowledgements for us.
|
||||||
"""
|
"""
|
||||||
# <- :GL|!~GL@127.0.0.1 JOIN #whatever
|
# <- :GL|!~GL@127.0.0.1 JOIN #whatever
|
||||||
channel = args[0]
|
channel = args[0]
|
||||||
self.join(source, channel)
|
|
||||||
|
|
||||||
|
# Only fetch modes, TS, and user hosts once we're actually in the channel.
|
||||||
|
# The IRCd will send us a JOIN with our nick!user@host if our JOIN succeeded.
|
||||||
|
if self.pseudoclient and source == self.pseudoclient.uid:
|
||||||
|
self.send('MODE %s' % channel)
|
||||||
|
self._send_who(channel)
|
||||||
|
|
||||||
|
self.channels[channel].users.add(source)
|
||||||
|
self.users[source].channels.add(channel)
|
||||||
|
|
||||||
|
self.call_hooks([source, 'CLIENTBOT_JOIN', {'channel': channel}])
|
||||||
return {'channel': channel, 'users': [source], 'modes': self.channels[channel].modes}
|
return {'channel': channel, 'users': [source], 'modes': self.channels[channel].modes}
|
||||||
|
|
||||||
def handle_kick(self, source, command, args):
|
def handle_kick(self, source, command, args):
|
||||||
|
Loading…
Reference in New Issue
Block a user