add some colors in the notification message.
This commit is contained in:
parent
c90821186e
commit
bf93f42503
|
@ -833,13 +833,13 @@ class Bantracker(callbacks.Plugin):
|
||||||
if not self.registryValue('autoremove', channel):
|
if not self.registryValue('autoremove', channel):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
if type == 'quiet':
|
||||||
|
mask = mask[1:]
|
||||||
self.log.info("%s [%s] %s in %s expired", type,
|
self.log.info("%s [%s] %s in %s expired", type,
|
||||||
ban.ban.id,
|
ban.ban.id,
|
||||||
mask,
|
mask,
|
||||||
channel)
|
channel)
|
||||||
# send unban msg
|
# send unban msg
|
||||||
if type == 'quiet':
|
|
||||||
mask = mask[1:]
|
|
||||||
unban = ircmsgs.mode(channel, (modedict[type], mask))
|
unban = ircmsgs.mode(channel, (modedict[type], mask))
|
||||||
irc.queueMsg(unban)
|
irc.queueMsg(unban)
|
||||||
|
|
||||||
|
@ -853,12 +853,17 @@ class Bantracker(callbacks.Plugin):
|
||||||
or not self.registryValue('autoremove.notify', channel):
|
or not self.registryValue('autoremove.notify', channel):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
type, mask = ban.ban.type, ban.ban.mask
|
||||||
|
if type == 'quiet':
|
||||||
|
mask = mask[1:]
|
||||||
for c in self.registryValue('autoremove.notify.channels', channel):
|
for c in self.registryValue('autoremove.notify.channels', channel):
|
||||||
notice = ircmsgs.notice(c, "%s [%s] %s in %s will expire in a few minutes." \
|
notice = ircmsgs.notice(c, "%s %s%s%s %s in %s will expire in a few minutes." \
|
||||||
% (ban.ban.type,
|
% (type,
|
||||||
ban.ban.id,
|
ircutils.mircColor('[', 'light green'),
|
||||||
ban.ban.mask,
|
ircutils.bold(ban.ban.id),
|
||||||
channel))
|
ircutils.mircColor(']', 'light green'),
|
||||||
|
ircutils.mircColor(mask, 'teal'),
|
||||||
|
ircutils.mircColor(channel, 'teal')))
|
||||||
irc.queueMsg(notice)
|
irc.queueMsg(notice)
|
||||||
ban.notified = True
|
ban.notified = True
|
||||||
|
|
||||||
|
|
|
@ -416,7 +416,8 @@ class BantrackerTestCase(ChannelPluginTestCase):
|
||||||
cb.autoRemoveBans(self.irc)
|
cb.autoRemoveBans(self.irc)
|
||||||
msg = self.irc.takeMsg()
|
msg = self.irc.takeMsg()
|
||||||
self.assertEqual(str(msg).strip(),
|
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.
|
# don't send the notice again.
|
||||||
cb.autoRemoveBans(self.irc)
|
cb.autoRemoveBans(self.irc)
|
||||||
self.assertFalse(self.irc.takeMsg())
|
self.assertFalse(self.irc.takeMsg())
|
||||||
|
|
Loading…
Reference in New Issue