banremove should only work with bans or quiets.
This commit is contained in:
parent
4d5ea85544
commit
800a228d92
|
@ -1469,8 +1469,14 @@ class Bantracker(callbacks.Plugin):
|
||||||
irc.reply("Ban '%s' isn't active in %s." % (mask, channel))
|
irc.reply("Ban '%s' isn't active in %s." % (mask, channel))
|
||||||
return
|
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))
|
self.managedBans.add(BanRemoval(ban, seconds))
|
||||||
irc.replySuccess()
|
irc.replySuccess()
|
||||||
|
|
||||||
banremove = wrap(banremove, ['id', 'text'])
|
banremove = wrap(banremove, ['id', 'text'])
|
||||||
|
|
||||||
def banlink(self, irc, msg, args, id, highlight):
|
def banlink(self, irc, msg, args, id, highlight):
|
||||||
|
|
|
@ -371,6 +371,11 @@ class BantrackerTestCase(ChannelPluginTestCase):
|
||||||
msg = self.irc.takeMsg() # unban msg
|
msg = self.irc.takeMsg() # unban msg
|
||||||
self.assertEqual(str(msg).strip(), "MODE #test -q :asd!*@*")
|
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):
|
def testBanremoveBadId(self):
|
||||||
self.assertResponse('banremove 1 0', "I don't know any ban with that id.")
|
self.assertResponse('banremove 1 0', "I don't know any ban with that id.")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue