3
0
mirror of https://github.com/jlu5/PyLink.git synced 2025-01-12 05:02:33 +01:00

exttargets: match account names case insensitively

This commit is contained in:
James Lu 2016-07-07 11:11:13 -07:00
parent 3e28856944
commit 724ab0a45e

View File

@ -16,7 +16,8 @@ def bind(func):
def account(irc, host, uid): def account(irc, host, uid):
""" """
$account exttarget handler. The following forms are supported, with groups separated by a $account exttarget handler. The following forms are supported, with groups separated by a
literal colon. All account and network name matching is currently case sensitive: literal colon. Account matching is case insensitive, while network name matching IS case
sensitive.
$account -> Returns True (a match) if the target is registered. $account -> Returns True (a match) if the target is registered.
$account:accountname -> Returns True if the target's account name matches the one given, and the $account:accountname -> Returns True if the target's account name matches the one given, and the
@ -40,10 +41,10 @@ def account(irc, host, uid):
homenet, realuid) homenet, realuid)
return False return False
slogin = userobj.services_account slogin = irc.toLower(userobj.services_account)
# Split the given exttarget host into parts, so we know how many to look for. # Split the given exttarget host into parts, so we know how many to look for.
groups = host.split(':') groups = list(map(irc.toLower, host.split(':')))
log.debug('(%s) exttargets.account: groups to match: %s', irc.name, groups) log.debug('(%s) exttargets.account: groups to match: %s', irc.name, groups)
if len(groups) == 1: if len(groups) == 1: