mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-11 20:52:42 +01:00
Added an assert to banmask.
This commit is contained in:
parent
32eb85e3c5
commit
898a4e2ef1
@ -123,7 +123,6 @@ def isIP(s):
|
|||||||
>>> isIP('abc.abc.abc.abc')
|
>>> isIP('abc.abc.abc.abc')
|
||||||
0
|
0
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if s.translate(string.ascii, _ipchars) == '':
|
if s.translate(string.ascii, _ipchars) == '':
|
||||||
quads = s.split('.')
|
quads = s.split('.')
|
||||||
if len(quads) <= 4:
|
if len(quads) <= 4:
|
||||||
@ -145,6 +144,7 @@ def banmask(hostmask):
|
|||||||
>>> banmask('nick!user@10.0.0.1')
|
>>> banmask('nick!user@10.0.0.1')
|
||||||
'*!*@10.0.0.*'
|
'*!*@10.0.0.*'
|
||||||
"""
|
"""
|
||||||
|
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('.')])
|
||||||
|
Loading…
Reference in New Issue
Block a user