diff --git a/plugins/MessageParser/config.py b/plugins/MessageParser/config.py index e3528aa7a..5a884bd19 100644 --- a/plugins/MessageParser/config.py +++ b/plugins/MessageParser/config.py @@ -57,6 +57,9 @@ conf.registerChannelValue(MessageParser, 'enable', registry.Boolean(True, _("""Determines whether the message parser is enabled. If enabled, will trigger on regexps added to the regexp db."""))) +conf.registerChannelValue(MessageParser, 'enableForNotices', + registry.Boolean(False, _("""Determines whether the message parser + is enabled for NOTICE messages too."""))) conf.registerChannelValue(MessageParser, 'keepRankInfo', registry.Boolean(True, _("""Determines whether we keep updating the usage count for each regexp, for popularity ranking."""))) diff --git a/plugins/MessageParser/plugin.py b/plugins/MessageParser/plugin.py index e4cc8f3bd..59076db5a 100644 --- a/plugins/MessageParser/plugin.py +++ b/plugins/MessageParser/plugin.py @@ -146,13 +146,11 @@ class MessageParser(callbacks.Plugin, plugins.ChannelDBHandler): else: return True - def doPrivmsg(self, irc, msg): + def do_privmsg_notice(self, irc, msg): channel = msg.args[0] if not irc.isChannel(channel): return if self.registryValue('enable', channel): - if callbacks.addressed(irc.nick, msg): #message is direct command - return actions = [] results = [] for channel in set(map(plugins.getChannel, (channel, 'global'))): @@ -182,6 +180,14 @@ class MessageParser(callbacks.Plugin, plugins.ChannelDBHandler): for action in actions: self._runCommandFunction(irc, msg, action) + def doPrivmsg(self, irc, msg): + if not callbacks.addressed(irc.nick, msg): #message is not direct command + self.do_privmsg_notice(irc, msg) + + def doNotice(self, irc, msg): + if self.registryValue('enableForNotices', msg.args[0]): + self.do_privmsg_notice(irc, msg) + @internationalizeDocstring def add(self, irc, msg, args, channel, regexp, action): """[|global]