mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-02 17:29:22 +01:00
Fix banmask creation. Thanks Progval for the patch!
fixes https://sourceforge.net/tracker/?func=detail&aid=3088559&group_id=58965&atid=489447 incorporating patch https://sourceforge.net/tracker/?func=detail&aid=3163843&group_id=58965&atid=489449
This commit is contained in:
parent
fc1a3ab258
commit
a6d361573d
@ -196,7 +196,7 @@ def banmask(hostmask):
|
|||||||
L[-1] = '*'
|
L[-1] = '*'
|
||||||
return '*!*@' + ':'.join(L)
|
return '*!*@' + ':'.join(L)
|
||||||
else:
|
else:
|
||||||
if '.' in host:
|
if len(host.split('.')) > 2: # If it is a subdomain
|
||||||
return '*!*@*%s' % host[host.find('.'):]
|
return '*!*@*%s' % host[host.find('.'):]
|
||||||
else:
|
else:
|
||||||
return '*!*@' + host
|
return '*!*@' + host
|
||||||
|
@ -233,6 +233,10 @@ class FunctionsTestCase(SupyTestCase):
|
|||||||
msg.prefix),
|
msg.prefix),
|
||||||
'%r didn\'t match %r' % (msg.prefix, banmask))
|
'%r didn\'t match %r' % (msg.prefix, banmask))
|
||||||
self.assertEqual(ircutils.banmask('foobar!user@host'), '*!*@host')
|
self.assertEqual(ircutils.banmask('foobar!user@host'), '*!*@host')
|
||||||
|
self.assertEqual(ircutils.banmask('foobar!user@host.tld'),
|
||||||
|
'*!*@host.tld')
|
||||||
|
self.assertEqual(ircutils.banmask('foobar!user@sub.host.tld'),
|
||||||
|
'*!*@*.host.tld')
|
||||||
self.assertEqual(ircutils.banmask('foo!bar@2001::'), '*!*@2001::*')
|
self.assertEqual(ircutils.banmask('foo!bar@2001::'), '*!*@2001::*')
|
||||||
|
|
||||||
def testSeparateModes(self):
|
def testSeparateModes(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user