mirror of
https://github.com/jlu5/PyLink.git
synced 2024-12-24 19:52:53 +01:00
protocols: delete empty non-permanent channels
This commit is contained in:
parent
3b83c3d567
commit
61d95c19cc
@ -122,8 +122,12 @@ def removeClient(irc, numeric):
|
||||
|
||||
Removes a client from our internal databases, regardless
|
||||
of whether it's one of our pseudoclients or not."""
|
||||
for v in irc.channels.values():
|
||||
for c, v in irc.channels.copy().items():
|
||||
v.removeuser(numeric)
|
||||
# Clear empty non-permanent channels.
|
||||
if not (irc.channels[c].users or ((irc.cmodes.get('permanent'), None) in irc.channels[c].modes)):
|
||||
del irc.channels[c]
|
||||
|
||||
sid = numeric[:3]
|
||||
log.debug('Removing client %s from irc.users', numeric)
|
||||
del irc.users[numeric]
|
||||
@ -366,6 +370,9 @@ def handle_part(irc, source, command, args):
|
||||
reason = args[1]
|
||||
except IndexError:
|
||||
reason = ''
|
||||
# Clear empty non-permanent channels.
|
||||
if not (irc.channels[channel].users or ((irc.cmodes.get('permanent'), None) in irc.channels[channel].modes)):
|
||||
del irc.channels[channel]
|
||||
return {'channels': channels, 'text': reason}
|
||||
|
||||
def handle_error(irc, numeric, command, args):
|
||||
|
@ -378,9 +378,10 @@ def handle_part(irc, source, command, args):
|
||||
reason = args[1]
|
||||
except IndexError:
|
||||
reason = ''
|
||||
if not (irc.channels[channel].users or ((irc.cmodes.get('permanent'), None) in irc.channels[channel].modes)):
|
||||
del irc.channels[channel]
|
||||
return {'channels': channels, 'text': reason}
|
||||
|
||||
|
||||
def handle_sjoin(irc, servernumeric, command, args):
|
||||
# parameters: channelTS, channel, simple modes, opt. mode parameters..., nicklist
|
||||
channel = args[1].lower()
|
||||
|
Loading…
Reference in New Issue
Block a user