mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-30 14:49:28 +01:00
utils: also don't crash in applyModes for bad mode targets
This commit is contained in:
parent
e70dfb0811
commit
305db9f754
18
utils.py
18
utils.py
@ -285,12 +285,18 @@ def applyModes(irc, target, changedmodes):
|
|||||||
The target can be either a channel or a user; this is handled automatically."""
|
The target can be either a channel or a user; this is handled automatically."""
|
||||||
usermodes = not isChannel(target)
|
usermodes = not isChannel(target)
|
||||||
log.debug('(%s) Using usermodes for this query? %s', irc.name, usermodes)
|
log.debug('(%s) Using usermodes for this query? %s', irc.name, usermodes)
|
||||||
if usermodes:
|
|
||||||
old_modelist = irc.users[target].modes
|
try:
|
||||||
supported_modes = irc.umodes
|
if usermodes:
|
||||||
else:
|
old_modelist = irc.users[target].modes
|
||||||
old_modelist = irc.channels[target].modes
|
supported_modes = irc.umodes
|
||||||
supported_modes = irc.cmodes
|
else:
|
||||||
|
old_modelist = irc.channels[target].modes
|
||||||
|
supported_modes = irc.cmodes
|
||||||
|
except KeyError:
|
||||||
|
log.warning('(%s) Possible desync? Mode target %s is unknown.', irc.name, target)
|
||||||
|
return
|
||||||
|
|
||||||
modelist = set(old_modelist)
|
modelist = set(old_modelist)
|
||||||
log.debug('(%s) Applying modes %r on %s (initial modelist: %s)', irc.name, changedmodes, target, modelist)
|
log.debug('(%s) Applying modes %r on %s (initial modelist: %s)', irc.name, changedmodes, target, modelist)
|
||||||
for mode in changedmodes:
|
for mode in changedmodes:
|
||||||
|
Loading…
Reference in New Issue
Block a user