AttackProtector: Add support for temporary bans.
parent
cca795c62f
commit
a9dbcf4f1b
|
@ -67,12 +67,13 @@ class Punishment(registry.String):
|
|||
if s not in ('ban', 'kick', 'kban') and not s.startswith('mode+') and \
|
||||
not s.startswith('mode-') and not s.startswith('umode-') and \
|
||||
not s.startswith('umode+') and \
|
||||
not s.startswith('command ') and not s.startswith('kban+'):
|
||||
not s.startswith('command ') and \
|
||||
not s.startswith('kban+') and not s.startswith('ban+') :
|
||||
self.error()
|
||||
return
|
||||
if s.startswith('kban+'):
|
||||
if s.startswith('kban+') or s.startswith('ban+'):
|
||||
try:
|
||||
int(s[5:])
|
||||
int(s.split('+', 1)[1])
|
||||
except ValueError:
|
||||
self.error()
|
||||
return
|
||||
|
|
|
@ -207,6 +207,13 @@ class AttackProtector(callbacks.Plugin):
|
|||
elif punishment == 'ban':
|
||||
msg = ircmsgs.ban(channel, banmask)
|
||||
irc.queueMsg(msg)
|
||||
|
||||
if punishment.startswith('ban+'):
|
||||
time = int(punishment[4:])
|
||||
unban = functools.partial(irc.queueMsg,
|
||||
ircmsgs.unban(channel, banmask))
|
||||
schedule.addEvent(unban, time)
|
||||
|
||||
elif punishment.startswith('kban'):
|
||||
msg = ircmsgs.ban(channel, banmask)
|
||||
irc.queueMsg(msg)
|
||||
|
|
Loading…
Reference in New Issue