mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 05: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)
|
assert isUserHostmask(hostmask)
|
||||||
host = hostFromHostmask(hostmask)
|
host = hostFromHostmask(hostmask)
|
||||||
if isIP(host):
|
if isIP(host):
|
||||||
return ('*!*@%s.*' % host[:host.rfind('.')])
|
return '*!*@%s.*' % host[:host.rfind('.')]
|
||||||
else:
|
else:
|
||||||
return ('*!*@*%s' % host[host.find('.'):])
|
if '.' in host:
|
||||||
|
return '*!*@*%s' % host[host.find('.'):]
|
||||||
|
else:
|
||||||
|
return '*!*@' + host
|
||||||
|
|
||||||
_argModes = 'ovhblkqe'
|
_argModes = 'ovhblkqe'
|
||||||
def separateModes(args):
|
def separateModes(args):
|
||||||
|
@ -125,12 +125,13 @@ class FunctionsTestCase(unittest.TestCase):
|
|||||||
self.failIf(ircutils.isNick('8foo'))
|
self.failIf(ircutils.isNick('8foo'))
|
||||||
self.failIf(ircutils.isNick('10'))
|
self.failIf(ircutils.isNick('10'))
|
||||||
|
|
||||||
def banmask(self):
|
def testBanmask(self):
|
||||||
for msg in msgs:
|
for msg in msgs:
|
||||||
if ircutils.isUserHostmask(msg.prefix):
|
if ircutils.isUserHostmask(msg.prefix):
|
||||||
self.failUnless(ircutils.hostmaskPatternEqual
|
self.failUnless(ircutils.hostmaskPatternEqual
|
||||||
(ircutils.banmask(msg.prefix),
|
(ircutils.banmask(msg.prefix),
|
||||||
msg.prefix))
|
msg.prefix))
|
||||||
|
self.assertEqual(ircutils.banmask('foobar!user@host'), '*!*@host')
|
||||||
|
|
||||||
def testSeparateModes(self):
|
def testSeparateModes(self):
|
||||||
self.assertEqual(ircutils.separateModes(['+ooo', 'x', 'y', 'z']),
|
self.assertEqual(ircutils.separateModes(['+ooo', 'x', 'y', 'z']),
|
||||||
|
Loading…
Reference in New Issue
Block a user