From a0c0d833e3d71c67ef4e86209b34590495ba1262 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Fri, 15 Oct 2004 11:20:51 +0000 Subject: [PATCH] Let's make channellen parameterizable as well. --- src/ircutils.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/ircutils.py b/src/ircutils.py index 39db26fb2..acfaf6bb2 100644 --- a/src/ircutils.py +++ b/src/ircutils.py @@ -120,18 +120,19 @@ def isNick(s, strictRfc=True, nicklen=None): ret = len(s) <= nicklen return ret else: + # XXX special values to isChannel? return not isChannel(s) and \ not isUserHostmask(s) and \ not ' ' in s and not '!' in s -def isChannel(s, chantypes='#&+!'): +def isChannel(s, chantypes='#&+!', channellen=50): """Returns True if s is a valid IRC channel name.""" return s and \ - len(s) <= 50 and \ - ',' not in s and \ - '\x07' not in s and \ - s[0] in chantypes and \ - len(s.split()) == 1 + ',' not in s and \ + '\x07' not in s and \ + s[0] in chantypes and \ + len(s) <= channellen and \ + len(s.split(None, 1)) == 1 _patternCache = {} def _hostmaskPatternEqual(pattern, hostmask):