From 62298e7a44e8e6141f2086efc8d75b9c9569ea8e Mon Sep 17 00:00:00 2001 From: Shiz Date: Wed, 5 Feb 2014 11:15:24 +0100 Subject: [PATCH] Remove channel information after being kicked or parting. Also fixed _destroy_channel() to remove any users not in common anymore as a result of leaving the channel. --- pydle/client.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/pydle/client.py b/pydle/client.py index 15e8aa5..8915a65 100644 --- a/pydle/client.py +++ b/pydle/client.py @@ -200,6 +200,8 @@ class BasicClient: } def _destroy_channel(self, channel): + for user in self.channels[channel]['users']: + self._destroy_user(user, channel) del self.channels[channel] @@ -635,10 +637,13 @@ class BasicClient: for channel, target in zip(channels, targets): target, targetuser, targethost = protocol.parse_user(target) self._sync_user(target, targetuser, targethost) - - # Update nick list on channel. - if self.in_channel(channel): - self._destroy_user(target, channel) + + if self.is_same_nick(target, self.nickname): + self._destroy_channel(channel) + else: + # Update nick list on channel. + if self.in_channel(channel): + self._destroy_user(target, channel) self.on_kick(channel, target, kicker, reason) @@ -727,7 +732,7 @@ class BasicClient: # We left the channel. Remove from channel list. :( for channel in channels: if self.in_channel(channel): - del self.channels[channel] + self._destroy_channel(channel) else: # Someone else left. Remove them. for ch in channels: