mirror of
https://github.com/jlu5/PyLink.git
synced 2025-01-12 05:02:33 +01:00
clientbot: fix part/kick handling to only keep state for internal clients
This commit is contained in:
parent
3e91118644
commit
a662f93e15
@ -133,6 +133,12 @@ class ClientbotWrapperProtocol(Protocol):
|
|||||||
|
|
||||||
def kick(self, source, channel, target, reason=''):
|
def kick(self, source, channel, target, reason=''):
|
||||||
"""Sends channel kicks."""
|
"""Sends channel kicks."""
|
||||||
|
|
||||||
|
if self.irc.isInternalClient(target):
|
||||||
|
# Target was one of our virtual clients. Just remove them from the state.
|
||||||
|
self.handle_part(target, 'KICK', [channel, reason])
|
||||||
|
return
|
||||||
|
|
||||||
# TODO: handle kick failures and send rejoin hooks for the target
|
# TODO: handle kick failures and send rejoin hooks for the target
|
||||||
reason = self._formatText(source, reason)
|
reason = self._formatText(source, reason)
|
||||||
self.irc.send('KICK %s %s :%s' % (channel, self._expandPUID(target), reason))
|
self.irc.send('KICK %s %s :%s' % (channel, self._expandPUID(target), reason))
|
||||||
@ -463,7 +469,7 @@ class ClientbotWrapperProtocol(Protocol):
|
|||||||
self.kick_queue[channel][1].cancel()
|
self.kick_queue[channel][1].cancel()
|
||||||
del self.kick_queue[channel]
|
del self.kick_queue[channel]
|
||||||
|
|
||||||
self.part(target, channel, reason)
|
self.handle_part(target, 'KICK', [channel, reason])
|
||||||
return {'channel': channel, 'target': target, 'text': reason}
|
return {'channel': channel, 'target': target, 'text': reason}
|
||||||
|
|
||||||
def handle_mode(self, source, command, args):
|
def handle_mode(self, source, command, args):
|
||||||
@ -502,7 +508,8 @@ class ClientbotWrapperProtocol(Protocol):
|
|||||||
reason = ''
|
reason = ''
|
||||||
|
|
||||||
for channel in channels:
|
for channel in channels:
|
||||||
self.part(source, channel, reason)
|
self.irc.channels[channel].removeuser(source)
|
||||||
|
self.irc.users[source].channels -= set(channels)
|
||||||
|
|
||||||
return {'channels': channels, 'text': reason}
|
return {'channels': channels, 'text': reason}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user