From c6fcdd854c87d5283080c888dba43d41fc2f0d62 Mon Sep 17 00:00:00 2001 From: James Lu Date: Thu, 21 Jul 2016 19:11:19 -0700 Subject: [PATCH] parseModes: give prefix modes precedence over mode types --- classes.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/classes.py b/classes.py index dafe795..b5aaf66 100644 --- a/classes.py +++ b/classes.py @@ -538,7 +538,19 @@ class Irc(): arg = None log.debug('Current mode: %s%s; args left: %s', prefix, mode, args) try: - if mode in (supported_modes['*A'] + supported_modes['*B']): + if mode in self.prefixmodes and not usermodes: + # We're setting a prefix mode on someone (e.g. +o user1) + log.debug('Mode %s: This mode is a prefix mode.', mode) + arg = args.pop(0) + # Convert nicks to UIDs implicitly; most IRCds will want + # this already. + arg = self.nickToUid(arg) or arg + if arg not in self.users: # Target doesn't exist, skip it. + log.debug('(%s) Skipping setting mode "%s %s"; the ' + 'target doesn\'t seem to exist!', self.name, + mode, arg) + continue + elif mode in (supported_modes['*A'] + supported_modes['*B']): # Must have parameter. log.debug('Mode %s: This mode must have parameter.', mode) arg = args.pop(0) @@ -553,18 +565,6 @@ class Irc(): # Set the arg to the old one on the channel. arg = oldargs[0] log.debug("Mode %s: coersing argument of '*' to %r.", mode, arg) - elif mode in self.prefixmodes and not usermodes: - # We're setting a prefix mode on someone (e.g. +o user1) - log.debug('Mode %s: This mode is a prefix mode.', mode) - arg = args.pop(0) - # Convert nicks to UIDs implicitly; most IRCds will want - # this already. - arg = self.nickToUid(arg) or arg - if arg not in self.users: # Target doesn't exist, skip it. - log.debug('(%s) Skipping setting mode "%s %s"; the ' - 'target doesn\'t seem to exist!', self.name, - mode, arg) - continue elif prefix == '+' and mode in supported_modes['*C']: # Only has parameter when setting. log.debug('Mode %s: Only has parameter when setting.', mode)