new config option "dontRequestComment"

for prevent sending messages to specific ops, like floodbots.
This commit is contained in:
Elián Hanisch 2010-03-15 13:12:51 -03:00
parent fc99c36faf
commit c88cc2bbd9
2 changed files with 13 additions and 0 deletions

View File

@ -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."))

View File

@ -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)