mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-01 01:09:22 +01:00
utils.parseModes: fix handling of mode "-k *" on TS6
Charybdis allows unsetting +k without actually knowing the key by faking the argument when unsetting as a single "*". We'd need to know the real argument of the +k being removed, in order to remove the mode pair from the mode list.
This commit is contained in:
parent
254ccea0a3
commit
a8b16d9724
13
utils.py
13
utils.py
@ -178,9 +178,11 @@ def parseModes(irc, target, args):
|
|||||||
if usermodes:
|
if usermodes:
|
||||||
log.debug('(%s) Using irc.umodes for this query: %s', irc.name, irc.umodes)
|
log.debug('(%s) Using irc.umodes for this query: %s', irc.name, irc.umodes)
|
||||||
supported_modes = irc.umodes
|
supported_modes = irc.umodes
|
||||||
|
oldmodes = irc.users[target].modes
|
||||||
else:
|
else:
|
||||||
log.debug('(%s) Using irc.cmodes for this query: %s', irc.name, irc.cmodes)
|
log.debug('(%s) Using irc.cmodes for this query: %s', irc.name, irc.cmodes)
|
||||||
supported_modes = irc.cmodes
|
supported_modes = irc.cmodes
|
||||||
|
oldmodes = irc.channels[target].modes
|
||||||
res = []
|
res = []
|
||||||
for mode in modestring:
|
for mode in modestring:
|
||||||
if mode in '+-':
|
if mode in '+-':
|
||||||
@ -195,6 +197,17 @@ def parseModes(irc, target, args):
|
|||||||
# Must have parameter.
|
# Must have parameter.
|
||||||
log.debug('Mode %s: This mode must have parameter.', mode)
|
log.debug('Mode %s: This mode must have parameter.', mode)
|
||||||
arg = args.pop(0)
|
arg = args.pop(0)
|
||||||
|
if prefix == '-' and mode in supported_modes['*B'] and arg == '*':
|
||||||
|
# Charybdis allows unsetting +k without actually
|
||||||
|
# knowing the key by faking the argument when unsetting
|
||||||
|
# as a single "*".
|
||||||
|
# We'd need to know the real argument of +k for us to
|
||||||
|
# be able to unset the mode.
|
||||||
|
oldargs = [m[1] for m in oldmodes if m[0] == mode]
|
||||||
|
if oldargs:
|
||||||
|
# Set the arg to the old one on the channel.
|
||||||
|
arg = oldargs[0]
|
||||||
|
log.debug("Mode %s: coersing argument of '*' to %r.", mode, arg)
|
||||||
elif mode in irc.prefixmodes and not usermodes:
|
elif mode in irc.prefixmodes and not usermodes:
|
||||||
# We're setting a prefix mode on someone (e.g. +o user1)
|
# We're setting a prefix mode on someone (e.g. +o user1)
|
||||||
log.debug('Mode %s: This mode is a prefix mode.', mode)
|
log.debug('Mode %s: This mode is a prefix mode.', mode)
|
||||||
|
Loading…
Reference in New Issue
Block a user