diff --git a/Bantracker/plugin.py b/Bantracker/plugin.py index 5c4832c..8974aca 100644 --- a/Bantracker/plugin.py +++ b/Bantracker/plugin.py @@ -833,13 +833,13 @@ class Bantracker(callbacks.Plugin): if not self.registryValue('autoremove', channel): continue + if type == 'quiet': + mask = mask[1:] self.log.info("%s [%s] %s in %s expired", type, ban.ban.id, mask, channel) # send unban msg - if type == 'quiet': - mask = mask[1:] unban = ircmsgs.mode(channel, (modedict[type], mask)) irc.queueMsg(unban) @@ -853,12 +853,17 @@ class Bantracker(callbacks.Plugin): or not self.registryValue('autoremove.notify', channel): continue + type, mask = ban.ban.type, ban.ban.mask + if type == 'quiet': + mask = mask[1:] for c in self.registryValue('autoremove.notify.channels', channel): - notice = ircmsgs.notice(c, "%s [%s] %s in %s will expire in a few minutes." \ - % (ban.ban.type, - ban.ban.id, - ban.ban.mask, - channel)) + notice = ircmsgs.notice(c, "%s %s%s%s %s in %s will expire in a few minutes." \ + % (type, + ircutils.mircColor('[', 'light green'), + ircutils.bold(ban.ban.id), + ircutils.mircColor(']', 'light green'), + ircutils.mircColor(mask, 'teal'), + ircutils.mircColor(channel, 'teal'))) irc.queueMsg(notice) ban.notified = True diff --git a/Bantracker/test.py b/Bantracker/test.py index 2c43290..0382642 100644 --- a/Bantracker/test.py +++ b/Bantracker/test.py @@ -416,7 +416,8 @@ class BantrackerTestCase(ChannelPluginTestCase): cb.autoRemoveBans(self.irc) msg = self.irc.takeMsg() self.assertEqual(str(msg).strip(), - "NOTICE #test :ban [1] asd!*@* in #test will expire in a few minutes.") + "NOTICE #test :ban \x0309[\x03\x021\x02\x0309]\x03 \x0310asd!*@*\x03"\ + " in \x0310#test\x03 will expire in a few minutes.") # don't send the notice again. cb.autoRemoveBans(self.irc) self.assertFalse(self.irc.takeMsg())