mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-01 01:09:22 +01:00
apply_modes: treat modes with arguments case-insensitively
This commit is contained in:
parent
cb4d2cc384
commit
46f081e19b
13
classes.py
13
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:
|
|
||||||
# We're removing a mode that only takes arguments when setting.
|
|
||||||
# Remove all mode entries that use the same letter as the one
|
|
||||||
# we're unsetting.
|
|
||||||
existing = mapping.get(real_mode[0])
|
existing = mapping.get(real_mode[0])
|
||||||
if existing:
|
arg = real_mode[1]
|
||||||
|
# When removing a mode: check all existing modes with the same character
|
||||||
|
# If no args were needed on removal, remove all modes with that letter
|
||||||
|
# If an arg was given, remove all modes matching the arg (IRC case insensitive)
|
||||||
|
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