3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-30 14:49:28 +01:00

relay: don't expect that serverdata['channels'] is always present

This commit is contained in:
James Lu 2016-06-27 23:00:39 -07:00
parent 01d462c97f
commit 8b39635fa8

View File

@ -467,7 +467,7 @@ def removeChannel(irc, channel):
if irc is None: if irc is None:
return return
if channel not in map(str.lower, irc.serverdata['channels']): if channel not in map(str.lower, irc.serverdata.get('channels', [])):
world.services['pylink'].extra_channels[irc.name].discard(channel) world.services['pylink'].extra_channels[irc.name].discard(channel)
irc.proto.part(irc.pseudoclient.uid, channel, 'Channel delinked.') irc.proto.part(irc.pseudoclient.uid, channel, 'Channel delinked.')
@ -479,7 +479,7 @@ def removeChannel(irc, channel):
# Don't ever part the main client from any of its autojoin channels. # Don't ever part the main client from any of its autojoin channels.
else: else:
if user == irc.pseudoclient.uid and channel in \ if user == irc.pseudoclient.uid and channel in \
irc.serverdata['channels']: irc.serverdata.get('channels', []):
continue continue
irc.proto.part(user, channel, 'Channel delinked.') irc.proto.part(user, channel, 'Channel delinked.')
# Don't ever quit it either... # Don't ever quit it either...