Bantracker: strip '%' from quiets in the string that's send to channels/nicks.
This commit is contained in:
parent
223c3f9229
commit
638ccf7b47
|
@ -495,10 +495,13 @@ class Bantracker(callbacks.Plugin):
|
||||||
continue
|
continue
|
||||||
if not ban.id:
|
if not ban.id:
|
||||||
ban.id = self.get_banId(ban.mask, channel)
|
ban.id = self.get_banId(ban.mask, channel)
|
||||||
|
mask = ban.mask
|
||||||
|
if type == 'quiet':
|
||||||
|
mask = mask[1:]
|
||||||
if nickMatch(nick, self.registryValue('review.forward', channel)):
|
if nickMatch(nick, self.registryValue('review.forward', channel)):
|
||||||
s = "Hi, please somebody review the %s '%s' set by %s on %s in"\
|
s = "Hi, please somebody review the %s '%s' set by %s on %s in"\
|
||||||
" %s, link: %s/bans.cgi?log=%s" % (type,
|
" %s, link: %s/bans.cgi?log=%s" % (type,
|
||||||
ban.mask,
|
mask,
|
||||||
nick,
|
nick,
|
||||||
ban.ascwhen,
|
ban.ascwhen,
|
||||||
channel,
|
channel,
|
||||||
|
@ -508,7 +511,7 @@ class Bantracker(callbacks.Plugin):
|
||||||
else:
|
else:
|
||||||
s = "Hi, please review the %s '%s' that you set on %s in %s, link:"\
|
s = "Hi, please review the %s '%s' that you set on %s in %s, link:"\
|
||||||
" %s/bans.cgi?log=%s" % (type,
|
" %s/bans.cgi?log=%s" % (type,
|
||||||
ban.mask,
|
mask,
|
||||||
ban.ascwhen,
|
ban.ascwhen,
|
||||||
channel,
|
channel,
|
||||||
self.registryValue('bansite'),
|
self.registryValue('bansite'),
|
||||||
|
|
|
@ -211,7 +211,7 @@ class BantrackerTestCase(ChannelPluginTestCase):
|
||||||
# test again with two ops
|
# test again with two ops
|
||||||
self.feedBan('asd2!*@*')
|
self.feedBan('asd2!*@*')
|
||||||
self.irc.takeMsg()
|
self.irc.takeMsg()
|
||||||
self.feedBan('qwe!*@*', prefix='otherop!user@home.net')
|
self.feedBan('qwe!*@*', prefix='otherop!user@home.net', mode='q')
|
||||||
self.irc.takeMsg()
|
self.irc.takeMsg()
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
cb.reviewBans()
|
cb.reviewBans()
|
||||||
|
@ -223,7 +223,7 @@ class BantrackerTestCase(ChannelPluginTestCase):
|
||||||
self.feedMsg('Hi!', frm='mynickissocreative!user@home.net')
|
self.feedMsg('Hi!', frm='mynickissocreative!user@home.net')
|
||||||
msg = self.irc.takeMsg()
|
msg = self.irc.takeMsg()
|
||||||
self.assertEqual(str(msg).strip(),
|
self.assertEqual(str(msg).strip(),
|
||||||
"PRIVMSG mynickissocreative :Hi, please review the ban 'qwe!*@*' that you set on %s in #test, link: "\
|
"PRIVMSG mynickissocreative :Hi, please review the quiet 'qwe!*@*' that you set on %s in #test, link: "\
|
||||||
"%s/bans.cgi?log=3" %(cb.bans['#test'][2].ascwhen, pluginConf.bansite()))
|
"%s/bans.cgi?log=3" %(cb.bans['#test'][2].ascwhen, pluginConf.bansite()))
|
||||||
self.feedMsg('ping', to='test', frm='op!user@host.net') # in a query
|
self.feedMsg('ping', to='test', frm='op!user@host.net') # in a query
|
||||||
self.irc.takeMsg() # drop pong reply
|
self.irc.takeMsg() # drop pong reply
|
||||||
|
@ -238,6 +238,7 @@ class BantrackerTestCase(ChannelPluginTestCase):
|
||||||
pluginConf.review.forward.channels.set('#channel')
|
pluginConf.review.forward.channels.set('#channel')
|
||||||
cb = self.getCallback()
|
cb = self.getCallback()
|
||||||
self.feedBan('asd!*@*', prefix='bot!user@host.net')
|
self.feedBan('asd!*@*', prefix='bot!user@host.net')
|
||||||
|
self.feedBan('asd!*@*', prefix='bot!user@host.net', mode='q')
|
||||||
cb.reviewBans(self.irc)
|
cb.reviewBans(self.irc)
|
||||||
self.assertFalse(cb.pendingReviews)
|
self.assertFalse(cb.pendingReviews)
|
||||||
print 'waiting 2 secs..'
|
print 'waiting 2 secs..'
|
||||||
|
@ -245,10 +246,12 @@ class BantrackerTestCase(ChannelPluginTestCase):
|
||||||
cb.reviewBans(self.irc)
|
cb.reviewBans(self.irc)
|
||||||
# since it's a forward, it was sent already
|
# since it's a forward, it was sent already
|
||||||
self.assertFalse(cb.pendingReviews)
|
self.assertFalse(cb.pendingReviews)
|
||||||
msg = self.irc.takeMsg()
|
self.assertEqual(str(self.irc.takeMsg()).strip(),
|
||||||
self.assertEqual(str(msg).strip(),
|
|
||||||
"NOTICE #channel :Hi, please somebody review the ban 'asd!*@*' set by bot on %s in #test, link: "\
|
"NOTICE #channel :Hi, please somebody review the ban 'asd!*@*' set by bot on %s in #test, link: "\
|
||||||
"%s/bans.cgi?log=1" %(cb.bans['#test'][0].ascwhen, pluginConf.bansite()))
|
"%s/bans.cgi?log=1" %(cb.bans['#test'][0].ascwhen, pluginConf.bansite()))
|
||||||
|
self.assertEqual(str(self.irc.takeMsg()).strip(),
|
||||||
|
"NOTICE #channel :Hi, please somebody review the quiet 'asd!*@*' set by bot on %s in #test, link: "\
|
||||||
|
"%s/bans.cgi?log=2" %(cb.bans['#test'][0].ascwhen, pluginConf.bansite()))
|
||||||
|
|
||||||
def testReviewIgnore(self):
|
def testReviewIgnore(self):
|
||||||
pluginConf.review.setValue(True)
|
pluginConf.review.setValue(True)
|
||||||
|
|
Loading…
Reference in New Issue