diff --git a/RelayNext/config.py b/RelayNext/config.py index f781ec3..3c1680a 100644 --- a/RelayNext/config.py +++ b/RelayNext/config.py @@ -81,5 +81,8 @@ _events = ('quit', 'join', 'part', 'nick', 'mode', 'kick') for ev in _events: conf.registerChannelValue(RelayNext.events, 'relay%ss' % ev, registry.Boolean(True, """Determines whether the bot should relay %ss.""" % ev)) - +conf.registerChannelValue(RelayNext.events, 'userIgnored', + registry.SpaceSeparatedListOfStrings(['PRIVMSG', 'MODE'], ("""Determines what events + the relay should ignore from ignored users. Ignores are added using + Supybot's global ignore system."""))) # vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: diff --git a/RelayNext/plugin.py b/RelayNext/plugin.py index 03a3036..5e66632 100644 --- a/RelayNext/plugin.py +++ b/RelayNext/plugin.py @@ -36,6 +36,7 @@ import traceback import supybot.world as world import supybot.irclib as irclib import supybot.ircmsgs as ircmsgs +import supybot.ircdb as ircdb import supybot.conf as conf import supybot.utils as utils from supybot.commands import * @@ -216,6 +217,11 @@ class RelayNext(callbacks.Plugin): def relay(self, irc, msg, channel=None): channel = channel or msg.args[0] + ignoredevents = map(str.upper, self.registryValue('events.userIgnored')) + if msg.command in ignoredevents and ircdb.checkIgnored(msg.prefix): + self.log.debug("RelayNext (%s): ignoring message from %s", + irc.network, msg.prefix) + return # Get the source channel source = "%s@%s" % (channel, irc.network) source = source.lower()