From 48573b603375a4ef6f84ea56bb18ed9208e54c5f Mon Sep 17 00:00:00 2001 From: James Lu Date: Mon, 14 Sep 2015 17:57:20 -0700 Subject: [PATCH] utils.parseModes: autoconvert nicks->UIDs for prefix modes, skipping if the target doesn't exist. --- utils.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/utils.py b/utils.py index 36c65a1..5a2349b 100644 --- a/utils.py +++ b/utils.py @@ -206,6 +206,13 @@ def parseModes(irc, target, args): # 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 = nickToUid(irc, arg) or arg + if arg not in irc.users: # Target doesn't exist, skip it. + log.debug('(%s) Skipping setting mode "%s %s"; the ' + 'target doesn\'t seem to exist!') + continue elif prefix == '+' and mode in supported_modes['*C']: # Only has parameter when setting. log.debug('Mode %s: Only has parameter when setting.', mode)