From fc3d3e6c014a6a6f799916b39329cd5960fd5300 Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Tue, 27 Dec 2011 11:55:50 +0100 Subject: [PATCH] Prevent the 'hostmask' converter from returning '*!*@*' while 'foo!*@*' was given. --- plugins/Channel/test.py | 14 +++++++++++--- src/conf.py | 3 +++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/plugins/Channel/test.py b/plugins/Channel/test.py index 54ce68ac5..1c301ce7b 100644 --- a/plugins/Channel/test.py +++ b/plugins/Channel/test.py @@ -205,11 +205,19 @@ class ChannelTestCase(ChannelPluginTestCase): def testIgnore(self): orig = conf.supybot.protocols.irc.banmask() + def ignore(given, expect=None): + if expect is None: + expect = given + self.assertNotError('channel ignore add %s' % given) + self.assertResponse('channel ignore list', "'%s'" % expect) + self.assertNotError('channel ignore remove %s' % expect) + self.assertRegexp('channel ignore list', 'not currently') try: + ignore('foo!bar@baz', '*!bar@baz') + ignore('foo!*@*') conf.supybot.protocols.irc.banmask.setValue(['exact']) - self.assertNotError('channel ignore add foo!bar@baz') - self.assertResponse('channel ignore list', "'foo!bar@baz'") - self.assertNotError('channel ignore remove foo!bar@baz') + ignore('foo!bar@baz') + ignore('foo!*@*') self.assertError('ban add not!a.hostmask') finally: conf.supybot.protocols.irc.banmask.setValue(orig) diff --git a/src/conf.py b/src/conf.py index 326134097..4f8fb0bb0 100644 --- a/src/conf.py +++ b/src/conf.py @@ -988,6 +988,9 @@ class Banmask(registry.SpaceSeparatedSetOfStrings): bhost = host elif option == 'exact': return hostmask + if (bnick, buser, bhost) == ('*', '*', '*') and \ + ircutils.isUserHostmask(hostmask): + return hostmask return ircutils.joinHostmask(bnick, buser, bhost) registerChannelValue(supybot.protocols.irc, 'banmask',