3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-27 21:19:31 +01:00

ircs2s_common: ignore PART for channels that the user wasn't on

These extra parts caused issues with relay when receiving P10 KICK acknowledgements as they are treated as if the user was already in the channel.
This commit is contained in:
James Lu 2017-08-07 00:05:44 -07:00
parent aca78b52cf
commit b1b2394836

View File

@ -609,7 +609,11 @@ class IRCS2SProtocol(IRCCommonProtocol):
"""Handles incoming PART commands."""
channels = self.to_lower(args[0]).split(',')
for channel in channels:
for channel in channels.copy():
if source not in channel:
# Ignore channels the user isn't on, and remove them from any hook payloads.
channels.remove(channel)
self.channels[channel].remove_user(source)
try:
self.users[source].channels.discard(channel)
@ -625,6 +629,7 @@ class IRCS2SProtocol(IRCCommonProtocol):
if not (self.channels[channel].users or ((self.cmodes.get('permanent'), None) in self.channels[channel].modes)):
del self.channels[channel]
if channels:
return {'channels': channels, 'text': reason}
def handle_privmsg(self, source, command, args):