From 2fe6306aeec45e28512ab8d42c04ea36c1779995 Mon Sep 17 00:00:00 2001 From: Jon Bergli Heier Date: Thu, 13 Sep 2012 23:04:34 +0200 Subject: Changed filter to filter_channel, added filter_nick. --- fot.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'fot.py') diff --git a/fot.py b/fot.py index 01f91d6..28ffdff 100755 --- a/fot.py +++ b/fot.py @@ -94,8 +94,8 @@ class Bot(irc.IRCClient): channel_list = config.get(self.factory.server, 'channels').split() self.module_channels = dict([(x, []) for x in channel_list]) for m in modules.keys(): - if config.has_option('module/' + m, 'filter'): - mod_re = re.compile(config.get('module/' + m, 'filter')) + if config.has_option('module/' + m, 'filter_channel'): + mod_re = re.compile(config.get('module/' + m, 'filter_channel')) else: mod_re = None @@ -127,6 +127,12 @@ class Bot(irc.IRCClient): for mod in self.msg_callbacks: if priv or mod in self.module_channels[channel]: + # This is a somewhat hackish way to get the module name. + mod_name = mod.__module__.split('.')[-1] + if config.has_option('module/' + mod_name, 'filter_nick'): + filter_re = re.compile(config.get('module/' + mod_name, 'filter_nick')) + if not filter_re.match(nick): + continue try: mod.privmsg(nick, channel, msg) except: -- cgit v1.2.3