From 63cc79371d2725647b37c6325c93221c61eed2c0 Mon Sep 17 00:00:00 2001 From: Luke Rogers Date: Thu, 1 Aug 2013 21:17:13 +1200 Subject: [PATCH] Swapped order to avoid extra fnmatch() --- plugins/ignore.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/ignore.py b/plugins/ignore.py index 4f19ad5..04ff9c1 100755 --- a/plugins/ignore.py +++ b/plugins/ignore.py @@ -4,7 +4,7 @@ from fnmatch import fnmatch @hook.sieve -def ignoresieve(bot, input, func, type, args): +def ignore_sieve(bot, input, func, type, args): """ blocks input from ignored channels/hosts """ ignorelist = bot.config["plugins"]["ignore"]["ignored"] mask = input.mask.lower() @@ -15,12 +15,12 @@ def ignoresieve(bot, input, func, type, args): if 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": return input else: return None - elif pattern.startswith("#") and pattern in ignorelist: + elif fnmatch(mask, pattern): if input.command == "PRIVMSG" and input.lastparam[1:] == "unignore": return input else: