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>
This commit is contained in:
James McCoy 2011-10-29 17:22:27 -04:00
parent ce4d26514b
commit c9e548bdd9

View File

@ -400,6 +400,15 @@ class IrcState(IrcCommandDispatcher):
"""Returns the hostmask for a given nick.""" """Returns the hostmask for a given nick."""
return self.nicksToHostmasks[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({ _005converters = utils.InsensitivePreservingDict({
'modes': int, 'modes': int,
'keylen': int, 'keylen': int,