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

utils.parseModes: autoconvert nicks->UIDs for prefix modes, skipping if the target doesn't exist.

This commit is contained in:
James Lu 2015-09-14 17:57:20 -07:00
parent b0b9138720
commit 48573b6033

View File

@ -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)