3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-12-29 14:12:39 +01:00

exttarget: use match_text() to match exttarget text fields

(cherry picked from commit bfe8a23dbc)
This commit is contained in:
James Lu 2019-12-25 16:02:26 -08:00
parent 4d24aa236b
commit 52730268b0

View File

@ -76,8 +76,8 @@ def ircop(irc, host, uid):
# 1st scenario. # 1st scenario.
return irc.is_oper(uid) return irc.is_oper(uid)
else: else:
# 2nd scenario. Use match_host (ircmatch) to match the opertype glob to the opertype. # 2nd scenario. Match the opertype glob to the opertype.
return irc.match_host(groups[1], irc.users[uid].opertype) return irc.match_text(groups[1], irc.users[uid].opertype)
@bind @bind
def server(irc, host, uid): def server(irc, host, uid):
@ -96,7 +96,7 @@ def server(irc, host, uid):
sid = irc.get_server(uid) sid = irc.get_server(uid)
query = groups[1] query = groups[1]
# Return True if the SID matches the query or the server's name glob matches it. # Return True if the SID matches the query or the server's name glob matches it.
return sid == query or irc.match_host(query, irc.get_friendly_name(sid)) return sid == query or irc.match_text(query, irc.get_friendly_name(sid))
# $server alone is invalid. Don't match anything. # $server alone is invalid. Don't match anything.
return False return False
@ -205,7 +205,7 @@ def realname(irc, host, uid):
""" """
groups = host.split(':') groups = host.split(':')
if len(groups) >= 2: if len(groups) >= 2:
return irc.match_host(groups[1], irc.users[uid].realname) return irc.match_text(groups[1], irc.users[uid].realname)
@bind @bind
def service(irc, host, uid): def service(irc, host, uid):
@ -222,5 +222,5 @@ def service(irc, host, uid):
groups = host.split(':') groups = host.split(':')
if len(groups) >= 2: if len(groups) >= 2:
return irc.match_host(groups[1], irc.users[uid].service) return irc.match_text(groups[1], irc.users[uid].service)
return True # It *is* a service bot because of the check at the top. return True # It *is* a service bot because of the check at the top.