mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-23 11:12:47 +01:00
Fixed bug in ircutils.isNick, which allowed nicks to start with dashes.
This commit is contained in:
parent
14acfcafe4
commit
cede4a4a97
@ -114,10 +114,9 @@ def strEqual(nick1, nick2):
|
|||||||
|
|
||||||
nickEqual = strEqual
|
nickEqual = strEqual
|
||||||
|
|
||||||
_nickchars = r'_[]\`^{}|-'
|
_nickchars = r'[]\`_^{|}'
|
||||||
nickRe = re.compile(r'^[A-Za-z%s][0-9A-Za-z%s]*$'
|
nickRe = re.compile(r'^[A-Za-z%s][-0-9A-Za-z%s]*$'
|
||||||
% (re.escape(_nickchars), re.escape(_nickchars)))
|
% (re.escape(_nickchars), re.escape(_nickchars)))
|
||||||
|
|
||||||
def isNick(s, strictRfc=True, nicklen=None):
|
def isNick(s, strictRfc=True, nicklen=None):
|
||||||
"""s => bool
|
"""s => bool
|
||||||
Returns True if s is a valid IRC nick."""
|
Returns True if s is a valid IRC nick."""
|
||||||
|
@ -187,6 +187,8 @@ class FunctionsTestCase(SupyTestCase):
|
|||||||
self.failIf(ircutils.isNick(''))
|
self.failIf(ircutils.isNick(''))
|
||||||
self.failIf(ircutils.isNick('8foo'))
|
self.failIf(ircutils.isNick('8foo'))
|
||||||
self.failIf(ircutils.isNick('10'))
|
self.failIf(ircutils.isNick('10'))
|
||||||
|
self.failIf(ircutils.isNick('-'))
|
||||||
|
self.failIf(ircutils.isNick('-foo'))
|
||||||
conf.supybot.protocols.irc.strictRfc.setValue(False)
|
conf.supybot.protocols.irc.strictRfc.setValue(False)
|
||||||
self.failUnless(ircutils.isNick('services@something.undernet.net'))
|
self.failUnless(ircutils.isNick('services@something.undernet.net'))
|
||||||
finally:
|
finally:
|
||||||
|
Loading…
Reference in New Issue
Block a user