mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-24 03:29:28 +01:00
Correction: it is legal for a server name to end with '.', but it can't start with it
This commit is contained in:
parent
cfc840ebb3
commit
098b29ae2d
@ -156,7 +156,6 @@ def handle_ping(irc, source, command, args):
|
||||
_sendFromServer(irc, args[1], 'PONG %s %s' % (args[1], source))
|
||||
|
||||
def handle_privmsg(irc, source, command, args):
|
||||
prefix = irc.conf['bot']['prefix']
|
||||
if args[0] == irc.pseudoclient.uid:
|
||||
cmd_args = args[1].split(' ')
|
||||
cmd = cmd_args[0].lower()
|
||||
|
@ -51,13 +51,13 @@ class TestUtils(unittest.TestCase):
|
||||
self.assertTrue(utils.isChannel('##ABCD'))
|
||||
|
||||
def testIsServerName(self):
|
||||
self.assertFalse(utils.isServerName('s'))
|
||||
self.assertFalse(utils.isServerName('s.'))
|
||||
self.assertFalse(utils.isServerName('Invalid'))
|
||||
self.assertTrue(utils.isServerName('services.'))
|
||||
self.assertFalse(utils.isServerName('.s.s.s'))
|
||||
self.assertTrue(utils.isServerName('Hello.world'))
|
||||
self.assertFalse(utils.isServerName(''))
|
||||
self.assertTrue(utils.isServerName('pylink.overdrive.pw'))
|
||||
self.assertFalse(utils.isServerName(' i lost the game'))
|
||||
self.assertFalse(utils.isServerName(' i lost th.e game'))
|
||||
|
||||
def testJoinModes(self):
|
||||
res = utils.joinModes({('l', '50'), ('n', None), ('t', None)})
|
||||
|
3
utils.py
3
utils.py
@ -82,8 +82,7 @@ def _isASCII(s):
|
||||
return all(char in chars for char in s)
|
||||
|
||||
def isServerName(s):
|
||||
return _isASCII(s) and '.' in s and not s.startswith('.') \
|
||||
and not s.endswith('.')
|
||||
return _isASCII(s) and '.' in s and not s.startswith('.')
|
||||
|
||||
def parseModes(irc, target, args):
|
||||
"""Parses a mode string into a list of (mode, argument) tuples.
|
||||
|
Loading…
Reference in New Issue
Block a user