config rename:
Bantracker.commetRequest => Bantracker.request Bantracker.reviewAfterTime => Bantracker.request.review
This commit is contained in:
parent
fd55f019e1
commit
b0b823fef1
|
@ -34,26 +34,25 @@ conf.registerGlobalValue(Bantracker, 'database',
|
||||||
conf.registerGlobalValue(Bantracker, 'bansite',
|
conf.registerGlobalValue(Bantracker, 'bansite',
|
||||||
registry.String('', "Web site for the bantracker, without the 'bans.cgi' appended", private=True))
|
registry.String('', "Web site for the bantracker, without the 'bans.cgi' appended", private=True))
|
||||||
|
|
||||||
conf.registerGroup(Bantracker, 'commentRequest')
|
conf.registerGroup(Bantracker, 'request')
|
||||||
conf.registerChannelValue(Bantracker.commentRequest, 'type',
|
conf.registerChannelValue(Bantracker.request, 'type',
|
||||||
SpaceSeparatedListOfTypes(['removal', 'ban', 'quiet'],
|
SpaceSeparatedListOfTypes(['removal', 'ban', 'quiet'],
|
||||||
"List of events for which the bot should request a comment."))
|
"List of events for which the bot should request a comment."))
|
||||||
conf.registerChannelValue(Bantracker.commentRequest, 'ignore',
|
conf.registerChannelValue(Bantracker.request, 'ignore',
|
||||||
registry.SpaceSeparatedListOfStrings([],
|
registry.SpaceSeparatedListOfStrings(['FloodBot?', 'FloodBotK?', 'ChanServ'],
|
||||||
"List of nicks for which the bot won't request to comment a ban/quiet/removal."\
|
"List of nicks for which the bot won't request to comment a ban/quiet/removal."\
|
||||||
" Is case insensible and wildcards * ? are accepted."))
|
" Is case insensible and wildcards * ? are accepted."))
|
||||||
conf.registerChannelValue(Bantracker.commentRequest, 'forward',
|
conf.registerChannelValue(Bantracker.request, 'forward',
|
||||||
registry.SpaceSeparatedListOfStrings([],
|
registry.SpaceSeparatedListOfStrings([],
|
||||||
"List of nicks for which the bot will forward the request to"\
|
"List of nicks for which the bot will forward the request to"\
|
||||||
" the channels/nicks defined in forwards.channels option."\
|
" the channels/nicks defined in forwards.channels option."\
|
||||||
" Is case insensible and wildcards * ? are accepted."))
|
" Is case insensible and wildcards * ? are accepted."))
|
||||||
conf.registerChannelValue(Bantracker.commentRequest.forward, 'channels',
|
conf.registerChannelValue(Bantracker.request.forward, 'channels',
|
||||||
registry.SpaceSeparatedListOfStrings([],
|
registry.SpaceSeparatedListOfStrings([],
|
||||||
"List of channels/nicks to forward the request if the op that set the ban/quiet"\
|
"List of channels/nicks to forward the request if the op that set the ban/quiet"\
|
||||||
" is in the forward list."))
|
" is in the forward list."))
|
||||||
|
conf.registerChannelValue(Bantracker.request, 'review',
|
||||||
|
|
||||||
# temp config
|
|
||||||
conf.registerGlobalValue(Bantracker, 'reviewAfterTime',
|
|
||||||
registry.Float(7,
|
registry.Float(7,
|
||||||
"Days after which the bot will request for review a ban. Can be an integer or decimal value."))
|
"Days after which the bot will request for review a ban. Can be an integer or decimal value."))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -212,7 +212,6 @@ class PersistentCache(dict):
|
||||||
return (host, nick, command, channel, text)
|
return (host, nick, command, channel, text)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Bantracker(callbacks.Plugin):
|
class Bantracker(callbacks.Plugin):
|
||||||
"""Plugin to manage bans.
|
"""Plugin to manage bans.
|
||||||
See '@list Bantracker' and '@help <command>' for commands"""
|
See '@list Bantracker' and '@help <command>' for commands"""
|
||||||
|
@ -409,7 +408,7 @@ class Bantracker(callbacks.Plugin):
|
||||||
|
|
||||||
def requestComment(self, irc, channel, ban, type=None):
|
def requestComment(self, irc, channel, ban, type=None):
|
||||||
# check if we should request a comment
|
# check if we should request a comment
|
||||||
if nickMatch(ban.who, self.registryValue('commentRequest.ignore', channel=channel)):
|
if nickMatch(ban.who, self.registryValue('request.ignore', channel=channel)):
|
||||||
return
|
return
|
||||||
# check the type of the action taken
|
# check the type of the action taken
|
||||||
mask = ban.mask
|
mask = ban.mask
|
||||||
|
@ -418,7 +417,7 @@ class Bantracker(callbacks.Plugin):
|
||||||
if type == 'quiet':
|
if type == 'quiet':
|
||||||
mask = mask[1:]
|
mask = mask[1:]
|
||||||
# check if type is enabled
|
# check if type is enabled
|
||||||
if type not in self.registryValue('commentRequest.type', channel=channel):
|
if type not in self.registryValue('request.type', channel=channel):
|
||||||
return
|
return
|
||||||
# send msg
|
# send msg
|
||||||
prefix = conf.supybot.reply.whenAddressedBy.chars()[0] # prefix char for commands
|
prefix = conf.supybot.reply.whenAddressedBy.chars()[0] # prefix char for commands
|
||||||
|
@ -427,8 +426,8 @@ class Bantracker(callbacks.Plugin):
|
||||||
op = ircutils.nickFromHostmask(ban.who)
|
op = ircutils.nickFromHostmask(ban.who)
|
||||||
except:
|
except:
|
||||||
op = ban.who
|
op = ban.who
|
||||||
if nickMatch(op, self.registryValue('commentRequest.forward', channel=channel)):
|
if nickMatch(op, self.registryValue('request.forward', channel=channel)):
|
||||||
channels = self.registryValue('commentRequest.forward.channels', channel=channel)
|
channels = self.registryValue('request.forward.channels', channel=channel)
|
||||||
if channels:
|
if channels:
|
||||||
s = "Please somebody comment on the %s of %s in %s done by %s, use:"\
|
s = "Please somebody comment on the %s of %s in %s done by %s, use:"\
|
||||||
" %scomment %s <comment>" %(type, mask, channel, op, prefix, ban.id)
|
" %scomment %s <comment>" %(type, mask, channel, op, prefix, ban.id)
|
||||||
|
@ -441,25 +440,25 @@ class Bantracker(callbacks.Plugin):
|
||||||
s = "Please comment on the %s of %s in %s, use: %scomment %s <comment>" \
|
s = "Please comment on the %s of %s in %s, use: %scomment %s <comment>" \
|
||||||
%(type, mask, channel, prefix, ban.id)
|
%(type, mask, channel, prefix, ban.id)
|
||||||
self.log.info('SENDING: %s %s' %(op, s))
|
self.log.info('SENDING: %s %s' %(op, s))
|
||||||
#irc.reply(s, to=op, private=True)
|
irc.reply(s, to=op, private=True)
|
||||||
|
|
||||||
def reviewBans(self):
|
def reviewBans(self):
|
||||||
try:
|
try:
|
||||||
reviewAfterTime = int(self.registryValue('reviewAfterTime') * 86400)
|
|
||||||
if not reviewAfterTime:
|
|
||||||
# time is zero, do nothing
|
|
||||||
return
|
|
||||||
self.log.debug('Checking for bans that need review ...')
|
self.log.debug('Checking for bans that need review ...')
|
||||||
now = time.mktime(time.gmtime())
|
now = time.mktime(time.gmtime())
|
||||||
lastreview = self.pendingReviews.time
|
lastreview = self.pendingReviews.time
|
||||||
bansite = self.registryValue('bansite')
|
bansite = self.registryValue('bansite')
|
||||||
if not lastreview:
|
if not lastreview:
|
||||||
# initialize last time reviewed timestamp
|
# initialize last time reviewed timestamp
|
||||||
lastreview = now - reviewAfterTime
|
lastreview = now - self.registryValue('request.review')
|
||||||
for channel, bans in self.bans.iteritems():
|
for channel, bans in self.bans.iteritems():
|
||||||
ignore = self.registryValue('commentRequest.ignore', channel=channel)
|
reviewAfterTime = int(self.registryValue('request.review', channel=channel) * 86400)
|
||||||
forward = self.registryValue('commentRequest.forward', channel=channel)
|
if not reviewAfterTime:
|
||||||
fchannels = self.registryValue('commentRequest.forward.channels', channel=channel)
|
# time is zero, do nothing
|
||||||
|
continue
|
||||||
|
ignore = self.registryValue('request.ignore', channel=channel)
|
||||||
|
forward = self.registryValue('request.forward', channel=channel)
|
||||||
|
fchannels = self.registryValue('request.forward.channels', channel=channel)
|
||||||
for ban in bans:
|
for ban in bans:
|
||||||
type = guessBanType(ban.mask)
|
type = guessBanType(ban.mask)
|
||||||
if type in ('quiet', 'removal'):
|
if type in ('quiet', 'removal'):
|
||||||
|
@ -521,7 +520,7 @@ class Bantracker(callbacks.Plugin):
|
||||||
irc.queueMsg(msg)
|
irc.queueMsg(msg)
|
||||||
else:
|
else:
|
||||||
m = ircmsgs.privmsg(op, msg.args[1])
|
m = ircmsgs.privmsg(op, msg.args[1])
|
||||||
#irc.queueMsg(m)
|
irc.queueMsg(m)
|
||||||
del self.pendingReviews[host]
|
del self.pendingReviews[host]
|
||||||
|
|
||||||
def doLog(self, irc, channel, s):
|
def doLog(self, irc, channel, s):
|
||||||
|
|
Loading…
Reference in New Issue