Fixed invalidCommand flood protection.

This commit is contained in:
Jeremy Fincher 2004-09-10 07:40:24 +00:00
parent 915ab813c6
commit f21689a01a
1 changed files with 4 additions and 3 deletions

View File

@ -42,9 +42,11 @@ import supybot.fix as fix
import os import os
import sys import sys
import time
import getopt import getopt
from itertools import imap, ifilter from itertools import imap, ifilter
import supybot.log as log
import supybot.conf as conf import supybot.conf as conf
import supybot.utils as utils import supybot.utils as utils
import supybot.world as world import supybot.world as world
@ -72,8 +74,7 @@ conf.registerGlobalValue(conf.supybot.plugins.Misc, 'timestampFormat',
class Misc(callbacks.Privmsg): class Misc(callbacks.Privmsg):
def __init__(self): def __init__(self):
super(Misc, self).__init__() super(Misc, self).__init__()
timeout = conf.supybot.abuse.flood.command.invalid self.invalidCommands = ircutils.FloodQueue(60)
self.invalidCommands = ircutils.FloodQueue(timeout)
callAfter = utils.Everything() callAfter = utils.Everything()
callBefore = utils.Nothing() callBefore = utils.Nothing()
@ -100,7 +101,7 @@ class Misc(callbacks.Privmsg):
ircdb.ignores.add(banmask, time.time() + punishment) ircdb.ignores.add(banmask, time.time() + punishment)
irc.reply('You\'ve given me %s invalid commands within the last ' irc.reply('You\'ve given me %s invalid commands within the last '
'minute; I\'m now ignoring you for %s.' % 'minute; I\'m now ignoring you for %s.' %
(maximum, utils.timeElapsed(punishment))) (maximum, utils.timeElapsed(punishment, seconds=False)))
return return
# Now, for normal handling. # Now, for normal handling.
channel = msg.args[0] channel = msg.args[0]