3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-01 01:09:22 +01:00

_apply_modes: don't add prefix modes to mode sets even when prefixmodes=None

This commit is contained in:
James Lu 2018-03-02 20:47:21 -08:00
parent 054680c806
commit 1413aa6042

View File

@ -684,20 +684,21 @@ class PyLinkNetworkCoreWithUtils(PyLinkNetworkCore):
except IndexError:
real_mode = mode
if prefixmodes is not None and is_channel:
# We only handle +qaohv for now. Iterate over every supported mode:
# if the IRCd supports this mode and it is the one being set, add/remove
# the person from the corresponding prefix mode list (e.g. c.prefixmodes['op']
# for ops).
for pmode, pmodelist in prefixmodes.items():
if pmode in supported_modes and real_mode[0] == supported_modes[pmode]:
log.debug('(%s) Initial prefixmodes list: %s', self.name, pmodelist)
if mode[0][0] == '+':
pmodelist.add(mode[1])
else:
pmodelist.discard(mode[1])
if is_channel:
if prefixmodes is not None:
# We only handle +qaohv for now. Iterate over every supported mode:
# if the IRCd supports this mode and it is the one being set, add/remove
# the person from the corresponding prefix mode list (e.g. c.prefixmodes['op']
# for ops).
for pmode, pmodelist in prefixmodes.items():
if pmode in supported_modes and real_mode[0] == supported_modes[pmode]:
log.debug('(%s) Initial prefixmodes list: %s', self.name, pmodelist)
if mode[0][0] == '+':
pmodelist.add(mode[1])
else:
pmodelist.discard(mode[1])
log.debug('(%s) Final prefixmodes list: %s', self.name, pmodelist)
log.debug('(%s) Final prefixmodes list: %s', self.name, pmodelist)
if real_mode[0] in self.prefixmodes:
# Don't add prefix modes to Channel.modes; they belong in the