3
0
mirror of https://github.com/jlu5/PyLink.git synced 2025-05-05 22:27:24 +02:00

clientbot: abort when receiving a QUIT from uplink (#405)

This commit is contained in:
James Lu 2017-02-17 22:26:35 -08:00
parent 3e4a980ea6
commit 8424870ec3

View File

@ -4,7 +4,7 @@ import base64
from pylinkirc import utils, conf from pylinkirc import utils, conf
from pylinkirc.log import log from pylinkirc.log import log
from pylinkirc.classes import Protocol, IrcUser, IrcServer from pylinkirc.classes import Protocol, IrcUser, IrcServer, ProtocolError
FALLBACK_REALNAME = 'PyLink Relay Mirror Client' FALLBACK_REALNAME = 'PyLink Relay Mirror Client'
COMMON_PREFIXMODES = [('h', 'halfop'), ('a', 'admin'), ('q', 'owner'), ('y', 'owner')] COMMON_PREFIXMODES = [('h', 'halfop'), ('a', 'admin'), ('q', 'owner'), ('y', 'owner')]
@ -904,6 +904,10 @@ class ClientbotWrapperProtocol(Protocol):
def handle_quit(self, source, command, args): def handle_quit(self, source, command, args):
"""Handles incoming QUITs.""" """Handles incoming QUITs."""
if self.irc.pseudoclient and source == self.irc.pseudoclient.uid:
# Someone faked a quit from us? We should abort.
raise ProtocolError("Received QUIT from uplink (%s)" % args[0])
self.quit(source, args[0]) self.quit(source, args[0])
return {'text': args[0]} return {'text': args[0]}