AttackProtector: Add the 'umode' punishment.
parent
64a2c8c962
commit
04a42e5837
|
@ -14,5 +14,6 @@ individual flood's.
|
|||
For each flood type, you can define a punishment. More common are 'ban',
|
||||
'kick', 'kban'. You also can define modes, such as the default punishment
|
||||
for group joins: 'mode+i' (it defines the mode +i). You also can remove
|
||||
a mode, with the syntax 'mode-i'.
|
||||
a mode, with the syntax 'mode-i', or set/unset modes to the user, with
|
||||
'mode-v' or 'mode+v'.
|
||||
For a complete list of available modes, checkout the network's help pages.
|
||||
|
|
|
@ -192,6 +192,9 @@ class AttackProtector(callbacks.Plugin):
|
|||
elif punishment.startswith('mode'):
|
||||
msg = ircmsgs.mode(channel, punishment[len('mode'):])
|
||||
irc.queueMsg(msg)
|
||||
elif punishment.startswith('umode'):
|
||||
msg = ircmsgs.mode(channel, (punishment[len('umode'):], nick))
|
||||
irc.queueMsg(msg)
|
||||
elif punishment.startswith('command '):
|
||||
tokens = callbacks.tokenize(punishment[len('command '):])
|
||||
self.Proxy(irc, msg, tokens)
|
||||
|
|
|
@ -193,6 +193,19 @@ class AttackProtectorTestCase(ChannelPluginTestCase):
|
|||
self.assertNotRegexp('whoami', 'toto')
|
||||
self.assertError('capabilities')
|
||||
|
||||
#################################
|
||||
# Test punishments
|
||||
|
||||
def testDisable(self):
|
||||
for i in range(1, 11):
|
||||
msg = ircmsgs.privmsg(self.channel, 'Hi, this is a flood',
|
||||
prefix=self.prefix)
|
||||
self.irc.feedMsg(msg)
|
||||
self.assertNotError('config plugin.AttackProtector.message.punishment '
|
||||
'umode +b')
|
||||
return self._getIfAnswerIsEqual(ircmsgs.IrcMsg(prefix="", command="MODE",
|
||||
args=(self.channel, mode, self.nick)))
|
||||
|
||||
#################################
|
||||
# Global tests
|
||||
def testCleanCollection(self):
|
||||
|
|
Loading…
Reference in New Issue