2010-04-06 08:36:43 +00:00
|
|
|
import re
|
|
|
|
|
2010-01-17 04:24:36 +00:00
|
|
|
from util import hook
|
|
|
|
|
|
|
|
|
|
|
|
@hook.sieve
|
2010-03-27 08:42:27 +00:00
|
|
|
def sieve_suite(bot, input, func, kind, args):
|
2010-05-11 00:02:15 +00:00
|
|
|
if input.command == 'PRIVMSG' and \
|
2010-05-10 23:59:34 +00:00
|
|
|
input.nick.lower()[-3:] == 'bot' and args.get('ignorebots', True):
|
2010-05-07 23:16:44 +00:00
|
|
|
return None
|
2010-05-10 23:59:34 +00:00
|
|
|
|
|
|
|
if kind == "command":
|
|
|
|
if input.trigger in bot.config.get('disabled_commands', []):
|
2010-05-07 23:16:44 +00:00
|
|
|
return None
|
|
|
|
|
|
|
|
fn = re.match(r'^plugins.(.+).py$', func._filename)
|
|
|
|
disabled = bot.config.get('disabled_plugins', [])
|
|
|
|
if fn and fn.group(1).lower() in disabled:
|
2010-01-17 04:24:36 +00:00
|
|
|
return None
|
|
|
|
|
2010-01-25 00:30:00 +00:00
|
|
|
acl = bot.config.get('acls', {}).get(func.__name__)
|
|
|
|
if acl:
|
|
|
|
if 'deny-except' in acl:
|
2010-02-24 16:37:45 +00:00
|
|
|
allowed_channels = map(unicode.lower, acl['deny-except'])
|
2010-01-25 00:30:00 +00:00
|
|
|
if input.chan.lower() not in allowed_channels:
|
|
|
|
return None
|
|
|
|
if 'allow-except' in acl:
|
2010-02-24 16:37:45 +00:00
|
|
|
denied_channels = map(unicode.lower, acl['allow-except'])
|
2010-01-25 00:30:00 +00:00
|
|
|
if input.chan.lower() in denied_channels:
|
|
|
|
return None
|
2010-03-27 08:42:27 +00:00
|
|
|
|
2010-10-26 04:13:27 +00:00
|
|
|
if args.get('adminonly', False):
|
|
|
|
admins = bot.config.get('admins', [])
|
|
|
|
|
|
|
|
if input.host not in admins and input.nick not in admins:
|
|
|
|
return None
|
|
|
|
|
2010-01-17 04:24:36 +00:00
|
|
|
return input
|