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.
This commit is contained in:
Shiz 2014-02-05 11:15:24 +01:00
parent 2d337a935c
commit 62298e7a44
1 changed files with 10 additions and 5 deletions

View File

@ -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]
@ -636,6 +638,9 @@ class BasicClient:
target, targetuser, targethost = protocol.parse_user(target)
self._sync_user(target, targetuser, targethost)
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)
@ -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: