3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-28 05:29:25 +01:00

inspircd: make handle_part return a list of channels, not just one

Some IRCds, like TS6, allow sending multiple channels (as a comma-separated list) in PART.

Update relay accordingly.
This commit is contained in:
James Lu 2015-07-20 19:52:52 -07:00
parent 3494d4f794
commit 72be5ca79c
2 changed files with 22 additions and 20 deletions

View File

@ -258,8 +258,9 @@ def handle_nick(irc, numeric, command, args):
utils.add_hook(handle_nick, 'NICK') utils.add_hook(handle_nick, 'NICK')
def handle_part(irc, numeric, command, args): def handle_part(irc, numeric, command, args):
channel = args['channel'] channels = args['channels']
text = args['text'] text = args['text']
for channel in channels:
for netname, user in relayusers[(irc.name, numeric)].copy().items(): for netname, user in relayusers[(irc.name, numeric)].copy().items():
remoteirc = utils.networkobjects[netname] remoteirc = utils.networkobjects[netname]
remotechan = findRemoteChan(irc, remoteirc, channel) remotechan = findRemoteChan(irc, remoteirc, channel)

View File

@ -329,7 +329,8 @@ def handle_kick(irc, source, command, args):
return {'channel': channel, 'target': kicked, 'text': args[2]} return {'channel': channel, 'target': kicked, 'text': args[2]}
def handle_part(irc, source, command, args): def handle_part(irc, source, command, args):
channel = args[0].lower() channels = args[0].lower().split(',')
for channel in channels:
# We should only get PART commands for channels that exist, right?? # We should only get PART commands for channels that exist, right??
irc.channels[channel].removeuser(source) irc.channels[channel].removeuser(source)
try: try:
@ -340,7 +341,7 @@ def handle_part(irc, source, command, args):
reason = args[1] reason = args[1]
except IndexError: except IndexError:
reason = '' reason = ''
return {'channel': channel, 'text': reason} return {'channels': channels, 'text': reason}
def handle_error(irc, numeric, command, args): def handle_error(irc, numeric, command, args):
irc.connected = False irc.connected = False