From 58558c89ae059799e301a99132e01d7f227361d4 Mon Sep 17 00:00:00 2001 From: James Lu Date: Wed, 5 Jul 2017 02:17:15 -0700 Subject: [PATCH] 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? --- protocols/ngircd.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/protocols/ngircd.py b/protocols/ngircd.py index 27e4832..cc83562 100644 --- a/protocols/ngircd.py +++ b/protocols/ngircd.py @@ -309,4 +309,16 @@ class NgIRCdProtocol(IRCS2SProtocol): # Call hooks manually, because one JOIN command have multiple channels. 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