summaryrefslogtreecommitdiff
path: root/fot.py
diff options
context:
space:
mode:
authorJon Bergli Heier <snakebite@jvnv.net>2012-09-13 23:04:34 +0200
committerJon Bergli Heier <snakebite@jvnv.net>2012-09-13 23:04:34 +0200
commit2fe6306aeec45e28512ab8d42c04ea36c1779995 (patch)
tree1065a6a01bfbaf6343e5213541820e376e49a068 /fot.py
parentd1e2e9699cf99c3c5947a082b10ef649e7c79885 (diff)
Changed filter to filter_channel, added filter_nick.
Diffstat (limited to 'fot.py')
-rwxr-xr-xfot.py10
1 files changed, 8 insertions, 2 deletions
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: