mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 11:09:23 +01:00
Fixed bug in banmask when the host doesn't have a dot in it (rare, but possible).
This commit is contained in:
parent
7b86dfb195
commit
6004181695
@ -151,9 +151,12 @@ def banmask(hostmask):
|
||||
assert isUserHostmask(hostmask)
|
||||
host = hostFromHostmask(hostmask)
|
||||
if isIP(host):
|
||||
return ('*!*@%s.*' % host[:host.rfind('.')])
|
||||
return '*!*@%s.*' % host[:host.rfind('.')]
|
||||
else:
|
||||
return ('*!*@*%s' % host[host.find('.'):])
|
||||
if '.' in host:
|
||||
return '*!*@*%s' % host[host.find('.'):]
|
||||
else:
|
||||
return '*!*@' + host
|
||||
|
||||
_argModes = 'ovhblkqe'
|
||||
def separateModes(args):
|
||||
|
@ -125,12 +125,13 @@ class FunctionsTestCase(unittest.TestCase):
|
||||
self.failIf(ircutils.isNick('8foo'))
|
||||
self.failIf(ircutils.isNick('10'))
|
||||
|
||||
def banmask(self):
|
||||
def testBanmask(self):
|
||||
for msg in msgs:
|
||||
if ircutils.isUserHostmask(msg.prefix):
|
||||
self.failUnless(ircutils.hostmaskPatternEqual
|
||||
(ircutils.banmask(msg.prefix),
|
||||
msg.prefix))
|
||||
self.assertEqual(ircutils.banmask('foobar!user@host'), '*!*@host')
|
||||
|
||||
def testSeparateModes(self):
|
||||
self.assertEqual(ircutils.separateModes(['+ooo', 'x', 'y', 'z']),
|
||||
|
Loading…
Reference in New Issue
Block a user