mirror of
https://github.com/jlu5/PyLink.git
synced 2025-01-12 21:22:36 +01:00
clientbot: properly handle cases when the bot is told to kick itself
- Treat kicks to the PyLink client as a real user kick instead of a virtual one - Forward on kick hooks if the PyLink client is kick target - this allows things like autorejoin to work Closes #377.
This commit is contained in:
parent
79b3387bcb
commit
298913200c
@ -182,7 +182,7 @@ class ClientbotWrapperProtocol(IRCCommonProtocol):
|
|||||||
log.debug('(%s) kick: checking if target %s (nick: %s) is an internal client? %s',
|
log.debug('(%s) kick: checking if target %s (nick: %s) is an internal client? %s',
|
||||||
self.name, target, self.get_friendly_name(target),
|
self.name, target, self.get_friendly_name(target),
|
||||||
self.is_internal_client(target))
|
self.is_internal_client(target))
|
||||||
if self.is_internal_client(target):
|
if self.is_internal_client(target) and (self.pseudoclient and source != self.pseudoclient.uid):
|
||||||
# Target was one of our virtual clients. Just remove them from the state.
|
# Target was one of our virtual clients. Just remove them from the state.
|
||||||
self.handle_part(target, 'KICK', [channel, reason])
|
self.handle_part(target, 'KICK', [channel, reason])
|
||||||
|
|
||||||
@ -938,9 +938,11 @@ class ClientbotWrapperProtocol(IRCCommonProtocol):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if (not self.is_internal_client(source)) and not self.is_internal_server(source):
|
# Don't repeat hooks if we're the kicker, unless we're also the target.
|
||||||
# Don't repeat hooks if we're the kicker.
|
if self.is_internal_client(source) or self.is_internal_server(source):
|
||||||
return {'channel': channel, 'target': target, 'text': reason}
|
if self.pseudoclient and target != self.pseudoclient.uid:
|
||||||
|
return
|
||||||
|
return {'channel': channel, 'target': target, 'text': reason}
|
||||||
|
|
||||||
def handle_mode(self, source, command, args):
|
def handle_mode(self, source, command, args):
|
||||||
"""Handles MODE changes."""
|
"""Handles MODE changes."""
|
||||||
|
Loading…
Reference in New Issue
Block a user