diff --git a/plugins/Karma/config.py b/plugins/Karma/config.py index 376348b20..fcc62db1f 100644 --- a/plugins/Karma/config.py +++ b/plugins/Karma/config.py @@ -66,5 +66,8 @@ conf.registerChannelValue(Karma, 'allowSelfRating', conf.registerChannelValue(Karma, 'allowUnaddressedKarma', registry.Boolean(True, _("""Determines whether the bot will increase/decrease karma without being addressed."""))) +conf.registerChannelValue(Karma, 'onlyNicks', + registry.Boolean(False, _("""Determines whether the bot will + only increase/decrease karma for nicks in the current channel."""))) # vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: diff --git a/plugins/Karma/plugin.py b/plugins/Karma/plugin.py index 59275410d..c29bedabb 100644 --- a/plugins/Karma/plugin.py +++ b/plugins/Karma/plugin.py @@ -246,12 +246,13 @@ class Karma(callbacks.Plugin): def _doKarma(self, irc, msg, channel, thing): inc = self.registryValue('incrementChars', channel) dec = self.registryValue('decrementChars', channel) + onlynicks = self.registryValue('onlyNicks', channel) karma = '' for s in inc: if thing.endswith(s): thing = thing[:-len(s)] # Don't reply if the target isn't a nick - if thing.lower() not in map(ircutils.toLower, + if onlynicks and thing.lower() not in map(ircutils.toLower, irc.state.channels[channel].users): return if ircutils.strEqual(thing, msg.nick) and \ @@ -263,7 +264,7 @@ class Karma(callbacks.Plugin): for s in dec: if thing.endswith(s): thing = thing[:-len(s)] - if thing.lower() not in map(ircutils.toLower, + if onlynicks and thing.lower() not in map(ircutils.toLower, irc.state.channels[channel].users): return if ircutils.strEqual(thing, msg.nick) and \