mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 13:19:24 +01:00
Changed nickToLower to toLower (it works for channels too
This commit is contained in:
parent
40b8eb3956
commit
8d2ac8c359
@ -58,7 +58,7 @@ def addressed(nick, msg):
|
|||||||
return msg.args[1][1:].strip()
|
return msg.args[1][1:].strip()
|
||||||
else:
|
else:
|
||||||
return msg.args[1].strip()
|
return msg.args[1].strip()
|
||||||
elif ircutils.nickToLower(msg.args[1]).startswith(nick):
|
elif ircutils.toLower(msg.args[1]).startswith(nick):
|
||||||
try:
|
try:
|
||||||
return msg.args[1].split(None, 1)[1].strip()
|
return msg.args[1].split(None, 1)[1].strip()
|
||||||
except IndexError:
|
except IndexError:
|
||||||
|
@ -70,13 +70,13 @@ def joinHostmask(nick, ident, host):
|
|||||||
assert nick and ident and host
|
assert nick and ident and host
|
||||||
return '%s!%s@%s' % (nick, ident, host)
|
return '%s!%s@%s' % (nick, ident, host)
|
||||||
|
|
||||||
_lowertrans = string.maketrans(string.ascii_uppercase + r'\[]',
|
_lowertrans = string.maketrans(string.ascii_uppercase + r'\[]~',
|
||||||
string.ascii_lowercase + r'|{}')
|
string.ascii_lowercase + r'|{}^')
|
||||||
def nickToLower(nick):
|
def toLower(nick):
|
||||||
return nick.translate(_lowertrans)
|
return nick.translate(_lowertrans)
|
||||||
|
|
||||||
def nickEqual(nick1, nick2):
|
def nickEqual(nick1, nick2):
|
||||||
return nickToLower(nick1) == nickToLower(nick2)
|
return toLower(nick1) == toLower(nick2)
|
||||||
|
|
||||||
nickchars = string.ascii_lowercase + string.ascii_uppercase + r'-[]\\`^{}'
|
nickchars = string.ascii_lowercase + string.ascii_uppercase + r'-[]\\`^{}'
|
||||||
_nickre = re.compile(r'^[%s]+$' % re.escape(nickchars))
|
_nickre = re.compile(r'^[%s]+$' % re.escape(nickchars))
|
||||||
@ -87,10 +87,11 @@ def isNick(s):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
def isChannel(s):
|
def isChannel(s):
|
||||||
return (s and s[0] in '#&+!')
|
return (s and s[0] in '#&+!' and len(s) <= 50 and \
|
||||||
|
'\x07' not in s and ',' not in s and ' ' not in s)
|
||||||
|
|
||||||
def hostmaskPatternEqual(pattern, hostmask):
|
def hostmaskPatternEqual(pattern, hostmask):
|
||||||
return fnmatch.fnmatch(nickToLower(hostmask), nickToLower(pattern))
|
return fnmatch.fnmatch(toLower(hostmask), toLower(pattern))
|
||||||
|
|
||||||
_ipchars = string.digits + '.'
|
_ipchars = string.digits + '.'
|
||||||
def isIP(s):
|
def isIP(s):
|
||||||
@ -176,11 +177,11 @@ def replyTo(msg):
|
|||||||
class nick(str):
|
class nick(str):
|
||||||
"""This class does case-insensitive comparisons of nicks."""
|
"""This class does case-insensitive comparisons of nicks."""
|
||||||
def __init__(self, s):
|
def __init__(self, s):
|
||||||
self.lowered = nickToLower(s)
|
self.lowered = toLower(s)
|
||||||
|
|
||||||
def __eq__(self, s):
|
def __eq__(self, s):
|
||||||
try:
|
try:
|
||||||
return nickToLower(s) == self.lowered
|
return toLower(s) == self.lowered
|
||||||
except:
|
except:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user