mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-26 03:54:08 +01:00
irclib: Don't error when 004 is missing umodes and chanmodes.
This commit is contained in:
parent
76edd3189c
commit
0284ed9ebd
@ -624,9 +624,14 @@ class IrcState(IrcCommandDispatcher, log.Firewalled):
|
|||||||
Supported user and channel modes are cached"""
|
Supported user and channel modes are cached"""
|
||||||
# msg.args = [nick, server, ircd-version, umodes, modes,
|
# msg.args = [nick, server, ircd-version, umodes, modes,
|
||||||
# modes that require arguments? (non-standard)]
|
# modes that require arguments? (non-standard)]
|
||||||
self.ircd = msg.args[2] if len(msg.args) >= 3 else msg.args[1]
|
self.ircd = msg.args[2] if len(msg.args) > 2 else msg.args[1]
|
||||||
self.supported['umodes'] = frozenset(msg.args[3])
|
|
||||||
self.supported['chanmodes'] = frozenset(msg.args[4])
|
# The conditionals are for Twitch, which doesn't send umodes or
|
||||||
|
# chanmodes.
|
||||||
|
if len(msg.args) > 3:
|
||||||
|
self.supported['umodes'] = frozenset(msg.args[3])
|
||||||
|
if len(msg.args) > 4:
|
||||||
|
self.supported['chanmodes'] = frozenset(msg.args[4])
|
||||||
|
|
||||||
_005converters = utils.InsensitivePreservingDict({
|
_005converters = utils.InsensitivePreservingDict({
|
||||||
'modes': lambda s: int(s) if s else None, # it's optional
|
'modes': lambda s: int(s) if s else None, # it's optional
|
||||||
|
@ -387,6 +387,12 @@ class IrcStateTestCase(SupyTestCase):
|
|||||||
self.assertEqual(state.supported['chanmodes'],
|
self.assertEqual(state.supported['chanmodes'],
|
||||||
frozenset('biklmnopstveI'))
|
frozenset('biklmnopstveI'))
|
||||||
|
|
||||||
|
def testShort004(self):
|
||||||
|
state = irclib.IrcState()
|
||||||
|
state.addMsg(self.irc, ircmsgs.IrcMsg(':coulomb.oftc.net 004 testnick coulomb.oftc.net hybrid-7.2.2+oftc1.6.8'))
|
||||||
|
self.assertNotIn('umodes', state.supported)
|
||||||
|
self.assertNotIn('chanmodes', state.supported)
|
||||||
|
|
||||||
def testEmptyTopic(self):
|
def testEmptyTopic(self):
|
||||||
state = irclib.IrcState()
|
state = irclib.IrcState()
|
||||||
state.addMsg(self.irc, ircmsgs.topic('#foo'))
|
state.addMsg(self.irc, ircmsgs.topic('#foo'))
|
||||||
|
Loading…
Reference in New Issue
Block a user