From c88cc2bbd9765658f36c19498a9df47725550f0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eli=C3=A1n=20Hanisch?= Date: Mon, 15 Mar 2010 13:12:51 -0300 Subject: [PATCH] new config option "dontRequestComment" for prevent sending messages to specific ops, like floodbots. --- Bantracker/config.py | 5 +++++ Bantracker/plugin.py | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/Bantracker/config.py b/Bantracker/config.py index 40191ed..df5ac91 100644 --- a/Bantracker/config.py +++ b/Bantracker/config.py @@ -25,3 +25,8 @@ conf.registerGlobalValue(conf.supybot.plugins.Bantracker, 'database', registry.String('', "Filename of the bans database", private=True)) conf.registerGlobalValue(conf.supybot.plugins.Bantracker, 'bansite', registry.String('', "Web site for the bantracker, without the 'bans.cgi' appended", private=True)) + +conf.registerChannelValue(Bantracker, 'dontRequestComment', + registry.SpaceSeparatedListOfStrings([], + "List of nicks for which the bot won't request to comment a ban/quiet/removal. "\ + "Is case insensible and wildcards * ? are accepted.")) diff --git a/Bantracker/plugin.py b/Bantracker/plugin.py index 825a046..227ea6b 100644 --- a/Bantracker/plugin.py +++ b/Bantracker/plugin.py @@ -48,6 +48,7 @@ import supybot.callbacks as callbacks import supybot.ircmsgs as ircmsgs import supybot.conf as conf import supybot.ircdb as ircdb +from fnmatch import fnmatch import sqlite import pytz import cPickle @@ -327,6 +328,12 @@ class Bantracker(callbacks.Plugin): return data def requestComment(self, irc, channel, ban, type=None): + # check if we should request a comment + opnick = ban.who.lower() + for pattern in self.registryValue('dontRequestComment', channel=channel): + if fnmatch(opnick, pattern): + return + # check the type of the action taken mask = ban.mask if not type: if mask[0] == '%': @@ -336,6 +343,7 @@ class Bantracker(callbacks.Plugin): type = 'ban' else: type = 'removal' + # send msg s = "Please comment on the %s of %s in %s with the ID %s" %(type, mask, channel, ban.id) irc.reply(s, to=ban.who, private=True)