From 4232e40e262cbbdb675b1cf315c43f576d8b1f43 Mon Sep 17 00:00:00 2001 From: James McCoy Date: Mon, 7 Nov 2011 05:58:27 -0500 Subject: [PATCH] Fix parsing of 004 message for supported umodes/chanmodes Signed-off-by: James McCoy --- src/irclib.py | 6 +++--- test/test_irclib.py | 7 +++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/irclib.py b/src/irclib.py index c095a4fe3..e33863e52 100644 --- a/src/irclib.py +++ b/src/irclib.py @@ -404,10 +404,10 @@ class IrcState(IrcCommandDispatcher): """Handles parsing the 004 reply Supported user and channel modes are cached""" - # msg.args = [nick, server, ircd-version, umodes, modes, + # msg.args = [server, ircd-version, umodes, modes, # modes that require arguments? (non-standard)] - self.supported['umodes'] = msg.args[3] - self.supported['chanmodes'] = msg.args[4] + self.supported['umodes'] = msg.args[2] + self.supported['chanmodes'] = msg.args[3] _005converters = utils.InsensitivePreservingDict({ 'modes': int, diff --git a/test/test_irclib.py b/test/test_irclib.py index 52dc7e258..bda696be6 100644 --- a/test/test_irclib.py +++ b/test/test_irclib.py @@ -290,6 +290,13 @@ class IrcStateTestCase(SupyTestCase): state.addMsg(self.irc, ircmsgs.IrcMsg(':irc.inet.tele.dk 005 adkwbot WALLCHOPS KNOCK EXCEPTS INVEX MODES=4 MAXCHANNELS=20 MAXBANS=beI:100 MAXTARGETS=4 NICKLEN=9 TOPICLEN=120 KICKLEN=90 :are supported by this server')) self.assertEqual(state.supported['maxbans'], 100) + def testSupportedUmodes(self): + state = irclib.IrcState() + state.addMsg(self.irc, ircmsgs.IrcMsg(':charm.oftc.net 004 charm.oftc.net hybrid-7.2.2+oftc1.6.8 CDGPRSabcdfgiklnorsuwxyz biklmnopstveI bkloveI')) + self.assertEqual(state.supported['umodes'], 'CDGPRSabcdfgiklnorsuwxyz') + self.assertEqual(state.supported['chanmodes'], + 'biklmnopstveI') + def testEmptyTopic(self): state = irclib.IrcState() state.addMsg(self.irc, ircmsgs.topic('#foo'))