banremove should only work with bans or quiets.

This commit is contained in:
Elián Hanisch 2012-07-05 19:12:38 -03:00
parent 4d5ea85544
commit 800a228d92
2 changed files with 11 additions and 0 deletions

View File

@ -1469,8 +1469,14 @@ class Bantracker(callbacks.Plugin):
irc.reply("Ban '%s' isn't active in %s." % (mask, channel))
return
if ban.type not in ('ban', 'quiet'):
irc.reply("Id %s is a %s, only bans or quiets can be autoremoved." \
% (id, ban.type))
return
self.managedBans.add(BanRemoval(ban, seconds))
irc.replySuccess()
banremove = wrap(banremove, ['id', 'text'])
def banlink(self, irc, msg, args, id, highlight):

View File

@ -371,6 +371,11 @@ class BantrackerTestCase(ChannelPluginTestCase):
msg = self.irc.takeMsg() # unban msg
self.assertEqual(str(msg).strip(), "MODE #test -q :asd!*@*")
def testBanremoveBadType(self):
self.feedBan('nick', mode='k')
self.assertResponse('banremove 1 0',
"Id 1 is a removal, only bans or quiets can be autoremoved.")
def testBanremoveBadId(self):
self.assertResponse('banremove 1 0', "I don't know any ban with that id.")