irclib: Add support for 004 messages from the server

At a minimum, the message gives us the server name, ircd version, supported
umodes, and supported channel modes.  Add the umodes and channel modes to
self.supported.

Some IRCds (e.g., hybrid and ircd-seven) have an extra arg which seems to be
the channel modes that require arguments.

Signed-off-by: James McCoy <vega.james@gmail.com>
(cherry picked from commit c9e548bdd9)

Signed-off-by: Daniel Folkinshteyn <nanotube@users.sourceforge.net>
This commit is contained in:
James McCoy 2011-10-29 17:22:27 -04:00 committed by Daniel Folkinshteyn
parent c2b6633fe7
commit edbf43f81f

View File

@ -401,6 +401,15 @@ class IrcState(IrcCommandDispatcher):
"""Returns the hostmask for a given nick."""
return self.nicksToHostmasks[nick]
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,
# modes that require arguments? (non-standard)]
self.supported['umodes'] = msg.args[3]
self.supported['chanmodes'] = msg.args[4]
_005converters = utils.InsensitivePreservingDict({
'modes': int,
'keylen': int,