mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-01 01:09:22 +01:00
utils.applyModes: fix logging output; only remove delete modes with args if new args are different
Previously, you'd get interesting messages where in sequential FJOINs, PyLink would remove param-modes like ('f', '6:5') and then add it right back, thinking that it was a duplicate.
This commit is contained in:
parent
b27fcc7f8f
commit
1c7f2f6a83
10
utils.py
10
utils.py
@ -173,19 +173,19 @@ def applyModes(irc, target, changedmodes):
|
|||||||
continue
|
continue
|
||||||
if mode[0][0] == '+':
|
if mode[0][0] == '+':
|
||||||
# We're adding a mode
|
# We're adding a mode
|
||||||
existing = [m for m in modelist if m[0] == real_mode[0]]
|
existing = [m for m in modelist if m[0] == real_mode[0] and m[1] != real_mode[1]]
|
||||||
if existing and real_mode[1] and mode[0] not in irc.cmodes['*A']:
|
if existing and real_mode[1] and real_mode[0] not in irc.cmodes['*A']:
|
||||||
# The mode we're setting takes a parameter, but is not a list mode (like +beI).
|
# The mode we're setting takes a parameter, but is not a list mode (like +beI).
|
||||||
# Therefore, only one version of it can exist at a time, and we must remove
|
# Therefore, only one version of it can exist at a time, and we must remove
|
||||||
# any old modepairs using the same letter. Otherwise, we'll get duplicates when,
|
# any old modepairs using the same letter. Otherwise, we'll get duplicates when,
|
||||||
# for example, someone sets mode "+l 30" on a channel already set "+l 25".
|
# for example, someone sets mode "+l 30" on a channel already set "+l 25".
|
||||||
log.debug('(%s) Old modes for mode %r exist on %s, removing them: %s',
|
log.debug('(%s) Old modes for mode %r exist on %s, removing them: %s',
|
||||||
irc.name, mode, target, str(existing))
|
irc.name, real_mode, target, str(existing))
|
||||||
[modelist.discard(oldmode) for oldmode in existing]
|
[modelist.discard(oldmode) for oldmode in existing]
|
||||||
modelist.add(real_mode)
|
modelist.add(real_mode)
|
||||||
log.debug('(%s) Adding mode %r on %s', irc.name, mode, target)
|
log.debug('(%s) Adding mode %r on %s', irc.name, real_mode, target)
|
||||||
else:
|
else:
|
||||||
log.debug('(%s) Removing mode %r on %s', irc.name, mode, target)
|
log.debug('(%s) Removing mode %r on %s', irc.name, real_mode, target)
|
||||||
# We're removing a mode
|
# We're removing a mode
|
||||||
if real_mode[1] is None:
|
if real_mode[1] is None:
|
||||||
# We're removing a mode that only takes arguments when setting.
|
# We're removing a mode that only takes arguments when setting.
|
||||||
|
Loading…
Reference in New Issue
Block a user