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