Permalink
Browse files

Fix parsing of 004 message for supported umodes/chanmodes

Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
  • Loading branch information...
1 parent 72077c8 commit d9531d2d2932c1e179bab96df1a6607f349c2393 @jamessan jamessan committed with Nov 7, 2011
Showing with 10 additions and 3 deletions.
  1. +3 −3 src/irclib.py
  2. +7 −0 test/test_irclib.py
View
@@ -406,10 +406,10 @@ def do004(self, irc, msg):
"""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,
View
@@ -290,6 +290,13 @@ def testIRCNet005(self):
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'))

0 comments on commit d9531d2

Please sign in to comment.