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

ngircd: ignore KILLs not meant for us

ngIRCd sends QUIT after a successful KILL, so trying to remove the target twice is erroneous and will cause a crash.

TODO: what happens if an external KILL is never responded to for whatever reason?
This commit is contained in:
James Lu 2017-07-05 02:17:15 -07:00
parent 30b9f47023
commit 58558c89ae

View File

@ -309,4 +309,16 @@ class NgIRCdProtocol(IRCS2SProtocol):
# Call hooks manually, because one JOIN command have multiple channels. # Call hooks manually, because one JOIN command have multiple channels.
self.call_hooks([source, command, {'channel': channel, 'users': [source], 'modes': c.modes}]) self.call_hooks([source, command, {'channel': channel, 'users': [source], 'modes': c.modes}])
def handle_kill(self, source, command, args):
"""Handles incoming KILLs."""
# ngIRCd sends QUIT after KILL for its own clients, so we shouldn't process this by itself
# unless we're the target.
killed = self._get_UID(args[0])
if self.is_internal_client(killed):
return super().handle_kill(source, command, args)
else:
log.debug("(%s) Ignoring KILL to %r as it isn't meant for us; we should see a QUIT soon",
self.name, killed)
Class = NgIRCdProtocol Class = NgIRCdProtocol