mirror of https://github.com/Shizmob/pydle.git
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:
parent
2d337a935c
commit
62298e7a44
|
@ -200,6 +200,8 @@ class BasicClient:
|
||||||
}
|
}
|
||||||
|
|
||||||
def _destroy_channel(self, channel):
|
def _destroy_channel(self, channel):
|
||||||
|
for user in self.channels[channel]['users']:
|
||||||
|
self._destroy_user(user, channel)
|
||||||
del self.channels[channel]
|
del self.channels[channel]
|
||||||
|
|
||||||
|
|
||||||
|
@ -635,10 +637,13 @@ class BasicClient:
|
||||||
for channel, target in zip(channels, targets):
|
for channel, target in zip(channels, targets):
|
||||||
target, targetuser, targethost = protocol.parse_user(target)
|
target, targetuser, targethost = protocol.parse_user(target)
|
||||||
self._sync_user(target, targetuser, targethost)
|
self._sync_user(target, targetuser, targethost)
|
||||||
|
|
||||||
# Update nick list on channel.
|
if self.is_same_nick(target, self.nickname):
|
||||||
if self.in_channel(channel):
|
self._destroy_channel(channel)
|
||||||
self._destroy_user(target, channel)
|
else:
|
||||||
|
# Update nick list on channel.
|
||||||
|
if self.in_channel(channel):
|
||||||
|
self._destroy_user(target, channel)
|
||||||
|
|
||||||
self.on_kick(channel, target, kicker, reason)
|
self.on_kick(channel, target, kicker, reason)
|
||||||
|
|
||||||
|
@ -727,7 +732,7 @@ class BasicClient:
|
||||||
# We left the channel. Remove from channel list. :(
|
# We left the channel. Remove from channel list. :(
|
||||||
for channel in channels:
|
for channel in channels:
|
||||||
if self.in_channel(channel):
|
if self.in_channel(channel):
|
||||||
del self.channels[channel]
|
self._destroy_channel(channel)
|
||||||
else:
|
else:
|
||||||
# Someone else left. Remove them.
|
# Someone else left. Remove them.
|
||||||
for ch in channels:
|
for ch in channels:
|
||||||
|
|
Loading…
Reference in New Issue