3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-12-25 04:02:45 +01:00

unreal: fix JOIN handling & normalize channel case

Reported by Rascle on IRC.
This commit is contained in:
James Lu 2016-04-28 19:17:20 -07:00
parent cf5cc18855
commit b78b911323

View File

@ -513,24 +513,29 @@ class UnrealProtocol(TS6BaseProtocol):
def handle_join(self, numeric, command, args): def handle_join(self, numeric, command, args):
"""Handles the UnrealIRCd JOIN command.""" """Handles the UnrealIRCd JOIN command."""
# <- :GL JOIN #pylink,#test # <- :GL JOIN #pylink,#test
for channel in args[0].split(','): if args[0] == '0':
c = self.irc.channels[channel] # /join 0; part the user from all channels
if args[0] == '0': oldchans = self.irc.users[numeric].channels.copy()
# /join 0; part the user from all channels log.debug('(%s) Got /join 0 from %r, channel list is %r',
oldchans = self.irc.users[numeric].channels.copy() self.irc.name, numeric, oldchans)
log.debug('(%s) Got /join 0 from %r, channel list is %r', for ch in oldchans:
self.irc.name, numeric, oldchans) self.irc.channels[ch].users.discard(numeric)
for ch in oldchans: self.irc.users[numeric].channels.discard(ch)
self.irc.channels[ch].users.discard(numeric) return {'channels': oldchans, 'text': 'Left all channels.', 'parse_as': 'PART'}
self.irc.users[numeric].channels.discard(ch)
return {'channels': oldchans, 'text': 'Left all channels.', 'parse_as': 'PART'}
self.irc.users[numeric].channels.add(channel) else:
self.irc.channels[channel].users.add(numeric) for channel in args[0].split(','):
# Call hooks manually, because one JOIN command in UnrealIRCd can # Normalize channel case.
# have multiple channels... channel = utils.toLower(self.irc, channel)
self.irc.callHooks([numeric, command, {'channel': channel, 'users': [numeric], 'modes':
c.modes, 'ts': c.ts}]) c = self.irc.channels[channel]
self.irc.users[numeric].channels.add(channel)
self.irc.channels[channel].users.add(numeric)
# Call hooks manually, because one JOIN command in UnrealIRCd can
# have multiple channels...
self.irc.callHooks([numeric, command, {'channel': channel, 'users': [numeric], 'modes':
c.modes, 'ts': c.ts}])
def handle_sjoin(self, numeric, command, args): def handle_sjoin(self, numeric, command, args):
"""Handles the UnrealIRCd SJOIN command.""" """Handles the UnrealIRCd SJOIN command."""