class Connection # Base class for IRC connections. class DCCConnection(Connection) # Unimplemented. class Event # Class representing an IRC event. class IRC # Class that handles one or several IRC server connections. class IRCError(Exception) # Represents an IRC exception. class ServerConnection(Connection) # This class represents an IRC server connection. class ServerConnectionError(IRCError) class SimpleIRCClient # A simple single-server IRC client class. def _ctcp_dequote(message) # [Internal] Dequote a message according to CTCP specifications. def _parse_modes(mode_string, unary_modes='') # [Internal] def _ping_ponger(connection, event) # [Internal] def irc_lower(s) # Returns a lowercased string. def is_channel(string) # Check if a string is a channel name. def mask_matches(nick, mask) # Check if a nick matches a mask. def nm_to_h(s) # Get the host part of a nickmask. def nm_to_n(s) # Get the nick part of a nickmask. def nm_to_u(s) # Get the user part of a nickmask. def nm_to_uh(s) # Get the userhost part of a nickmask. def parse_channel_modes(mode_string) # Parse a channel mode string. def parse_nick_modes(mode_string) # Parse a nick mode string. int DEBUG = 0 tuple VERSION = (0, 3, 2) string _CTCP_DELIMITER = '\001' string _CTCP_LEVEL_QUOTE = '\\' string _LOW_LEVEL_QUOTE = '\020' string __file__ = './irclib.pyc' string _alpha = 'abcdefghijklmnopqrstuvwxyz' string _ircstring_translation = '\000\001\002\003\004\005\00...\371\372\373\374\375\376\377' instance _linesep_regexp = re.RegexObject instance dictionary _low_level_mapping = {'\020': '\020', '0': '\000', 'n': '\012', 'r': '\015'} instance _low_level_regexp = re.RegexObject instance instance _rfc_1459_command_regexp = re.RegexObject instance string _special = '-[]\\`^{}' list all_events = ['disconnect', 'ctcp', 'ctcpreply', 'error', 'join', 'kick', ...] list generated_events = ['disconnect', 'ctcp', 'ctcpreply'] string nick_characters = 'abcdefghijklmnopqrstuvwxyzA...RSTUVWXYZ0123456789-[]\\`^{}' dictionary numeric_events = {'001': 'welcome', '002': 'yourhost', '003': 'created', '004': 'myinfo', ...} list protocol_events = ['error', 'join', 'kick', 'mode', 'part', 'ping', ...]
This library is intended to encapsulate the IRC protocol at a quite low level. It provides an event-driven IRC client framework. It has a fairly thorough support for the basic IRC protocol and CTCP, but DCC connection support is not yet implemented.
In order to understand how to make an IRC client, I'm afraid you more or less must understand the IRC specifications. They are available here: IRC specifications.
[Internal] Dequote a message according to CTCP specifications.
The function returns a list where each element can be either a string (normal message) or a tuple of one or two strings (tagged messages). If a tuple has only one element (ie is a singleton), that element is the tag; otherwise the tuple has two elements: the tag and the data.Returns a lowercased string.
The definition of lowercased comes from the IRC specification (RFC 1459).Check if a string is a channel name.
Returns true if the argument is a channel name, otherwise false.Check if a nick matches a mask.
Returns true if the nick matches, otherwise false.Get the host part of a nickmask.
(The source of an Event is a nickmask.)Get the nick part of a nickmask.
(The source of an Event is a nickmask.)Get the user part of a nickmask.
(The source of an Event is a nickmask.)Get the userhost part of a nickmask.
(The source of an Event is a nickmask.)Parse a channel mode string.
The function returns a list of lists with three members: sign, mode and argument. The sign is "+" or "-". The argument is None if mode isn't one of "b", "k", "l", "v" or "o".Example:>>> irclib.parse_channel_modes("+ab-c foo") [['+', 'a', None], ['+', 'b', 'foo'], ['-', 'c', None]]
Parse a nick mode string.
The function returns a list of lists with three members: sign, mode and argument. The sign is "+" or "-". The argument is always None.
Example:
>>> irclib.parse_nick_modes("+ab-c") [['+', 'a', None], ['+', 'b', None], ['-', 'c', None]]
![]() |
|