Remove '+' from the default chantypes.

It's more likely to be a statusmsg than chantype.
This commit is contained in:
Valentin Lorentz 2019-08-04 21:28:45 +02:00
parent 696254ff1b
commit d4cac026d4
2 changed files with 7 additions and 5 deletions

View File

@ -143,7 +143,7 @@ def areNicks(s, strictRfc=True, nicklen=None):
nick = functools.partial(isNick, strictRfc=strictRfc, nicklen=nicklen)
return all(map(nick, s.split(',')))
def isChannel(s, chantypes='#&+!', channellen=50):
def isChannel(s, chantypes='#&!', channellen=50):
"""s => bool
Returns True if s is a valid IRC channel name."""
return s and \
@ -153,13 +153,13 @@ def isChannel(s, chantypes='#&+!', channellen=50):
len(s) <= channellen and \
len(s.split(None, 1)) == 1
def areChannels(s, chantypes='#&+!',channellen=50):
def areChannels(s, chantypes='#&!', channellen=50):
"""Like 'isChannel(x)' but for comma-separated list."""
chan = functools.partial(isChannel, chantypes=chantypes,
channellen=channellen)
return all(map(chan, s.split(',')))
def areReceivers(s, strictRfc=True, nicklen=None, chantypes='#&+!',
def areReceivers(s, strictRfc=True, nicklen=None, chantypes='#&!',
channellen=50):
"""Like 'isNick(x) or isChannel(x)' but for comma-separated list."""
nick = functools.partial(isNick, strictRfc=strictRfc, nicklen=nicklen)

View File

@ -75,11 +75,13 @@ class FunctionsTestCase(SupyTestCase):
def testIsChannel(self):
self.failUnless(ircutils.isChannel('#'))
self.failUnless(ircutils.isChannel('&'))
self.failUnless(ircutils.isChannel('+'))
self.failIf(ircutils.isChannel('+'))
self.failUnless(ircutils.isChannel('+', chantypes='#&+!'))
self.failUnless(ircutils.isChannel('!'))
self.failUnless(ircutils.isChannel('#foo'))
self.failUnless(ircutils.isChannel('&foo'))
self.failUnless(ircutils.isChannel('+foo'))
self.failIf(ircutils.isChannel('+foo'))
self.failUnless(ircutils.isChannel('+foo', chantypes='#&+!'))
self.failUnless(ircutils.isChannel('!foo'))
self.failIf(ircutils.isChannel('#foo bar'))
self.failIf(ircutils.isChannel('#foo,bar'))