From 1413aa604237f7b4d53b8eee50b7c69ef0c8a25f Mon Sep 17 00:00:00 2001 From: James Lu Date: Fri, 2 Mar 2018 20:47:21 -0800 Subject: [PATCH] _apply_modes: don't add prefix modes to mode sets even when prefixmodes=None --- classes.py | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/classes.py b/classes.py index 9020a2c..9aaff4b 100644 --- a/classes.py +++ b/classes.py @@ -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