Swapped order to avoid extra fnmatch()
This commit is contained in:
parent
94244c7c86
commit
63cc79371d
1 changed files with 3 additions and 3 deletions
|
@ -4,7 +4,7 @@ from fnmatch import fnmatch
|
||||||
|
|
||||||
|
|
||||||
@hook.sieve
|
@hook.sieve
|
||||||
def ignoresieve(bot, input, func, type, args):
|
def ignore_sieve(bot, input, func, type, args):
|
||||||
""" blocks input from ignored channels/hosts """
|
""" blocks input from ignored channels/hosts """
|
||||||
ignorelist = bot.config["plugins"]["ignore"]["ignored"]
|
ignorelist = bot.config["plugins"]["ignore"]["ignored"]
|
||||||
mask = input.mask.lower()
|
mask = input.mask.lower()
|
||||||
|
@ -15,12 +15,12 @@ def ignoresieve(bot, input, func, type, args):
|
||||||
|
|
||||||
if ignorelist:
|
if ignorelist:
|
||||||
for pattern in ignorelist:
|
for pattern in ignorelist:
|
||||||
if fnmatch(mask, pattern):
|
if pattern.startswith("#") and pattern in ignorelist:
|
||||||
if input.command == "PRIVMSG" and input.lastparam[1:] == "unignore":
|
if input.command == "PRIVMSG" and input.lastparam[1:] == "unignore":
|
||||||
return input
|
return input
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
elif pattern.startswith("#") and pattern in ignorelist:
|
elif fnmatch(mask, pattern):
|
||||||
if input.command == "PRIVMSG" and input.lastparam[1:] == "unignore":
|
if input.command == "PRIVMSG" and input.lastparam[1:] == "unignore":
|
||||||
return input
|
return input
|
||||||
else:
|
else:
|
||||||
|
|
Reference in a new issue