mirror of
https://github.com/jlu5/PyLink.git
synced 2024-12-18 08:02:51 +01:00
apply_modes: treat modes with arguments case-insensitively
This commit is contained in:
parent
cb4d2cc384
commit
46f081e19b
17
classes.py
17
classes.py
@ -1061,16 +1061,15 @@ class PyLinkNetworkCoreWithUtils(PyLinkNetworkCore):
|
|||||||
else: # Removing a mode
|
else: # Removing a mode
|
||||||
log.debug('(%s) Removing mode %r from %s', self.name, real_mode, modelist)
|
log.debug('(%s) Removing mode %r from %s', self.name, real_mode, modelist)
|
||||||
|
|
||||||
if real_mode[1] is None:
|
existing = mapping.get(real_mode[0])
|
||||||
# We're removing a mode that only takes arguments when setting.
|
arg = real_mode[1]
|
||||||
# Remove all mode entries that use the same letter as the one
|
# When removing a mode: check all existing modes with the same character
|
||||||
# we're unsetting.
|
# If no args were needed on removal, remove all modes with that letter
|
||||||
existing = mapping.get(real_mode[0])
|
# If an arg was given, remove all modes matching the arg (IRC case insensitive)
|
||||||
if existing:
|
if existing is not None:
|
||||||
for oldvalue in existing:
|
for oldvalue in existing:
|
||||||
|
if arg is None or self.to_lower(arg) == self.to_lower(oldvalue):
|
||||||
modelist.discard((real_mode[0], oldvalue))
|
modelist.discard((real_mode[0], oldvalue))
|
||||||
else:
|
|
||||||
modelist.discard(real_mode)
|
|
||||||
log.debug('(%s) Final modelist: %s', self.name, modelist)
|
log.debug('(%s) Final modelist: %s', self.name, modelist)
|
||||||
return modelist
|
return modelist
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user