Internet Relay Chat protocol for client and server.
Future Plans
The way the IRCClient class works here encourages people to implement IRC clients by subclassing the ephemeral protocol class, and it tends to end up with way more state than it should for an object which will be destroyed as soon as the TCP transport drops. Someone oughta do something about that, ya know?
The DCC support needs to have more hooks for the client for it to be able to ask the user things like "Do you want to accept this session?" and "Transfer #2 is 67% done." and otherwise manage the DCC sessions.
Test coverage needs to be better.
Author | |
Kevin Turner | |
See Also | |
RFC 1459: Internet Relay Chat Protocol | |
RFC 2812: Internet Relay Chat: Client Protocol | |
The Client-To-Client-Protocol |
Class |
|
Direct Client Connection protocol type CHAT. |
Class |
|
Undocumented |
Class |
|
Higher-level coverage for getting a file from DCC SEND. |
Class |
|
Bare protocol to receive a Direct Client Connection SEND stream. |
Class |
|
Undocumented |
Class |
|
Protocol for an outgoing Direct Client Connection SEND. |
Class | IRC |
Internet Relay Chat server protocol. |
Class |
|
Internet Relay Chat client protocol, with sprinkles. |
Class |
|
Handle ISUPPORT messages. |
Exception |
|
Undocumented |
Exception |
|
A malformed mode was encountered while attempting to parse a mode string. |
Exception |
|
Undocumented |
Exception |
|
A command dispatcher could not locate an appropriate command handler. |
Function | assemble |
Assemble formatted text from structured information. |
Function | ctcp |
Undocumented |
Function | ctcp |
Extract CTCP data from a string. |
Function | ctcp |
Undocumented |
Function | ctcp |
No summary |
Function | dcc |
Given the data chunk from a DCC query, return a descriptive string. |
Function | dcc |
Undocumented |
Function | file |
I'll try my damndest to determine the size of this file object. |
Function | low |
Undocumented |
Function | low |
Undocumented |
Function | parse |
Parse text containing IRC formatting codes into structured information. |
Function | parse |
Parse an IRC mode string. |
Function | parsemsg |
Breaks a message from an IRC server into its prefix, command, and arguments. |
Function | split |
Split a string into multiple lines. |
Function | strip |
Remove all formatting codes from text, leaving only the text. |
Constant | CHANNEL |
Undocumented |
Constant | CR |
Undocumented |
Constant | ERR |
Undocumented |
Constant | ERR |
Undocumented |
Constant | ERR |
Undocumented |
Constant | ERR |
Undocumented |
Constant | ERR |
Undocumented |
Constant | ERR |
Undocumented |
Constant | ERR |
Undocumented |
Constant | ERR |
Undocumented |
Constant | ERR |
Undocumented |
Constant | ERR |
Undocumented |
Constant | ERR |
Undocumented |
Constant | ERR |
Undocumented |
Constant | ERR |
Undocumented |
Constant | ERR |
Undocumented |
Constant | ERR |
Undocumented |
Constant | ERR |
Undocumented |
Constant | ERR |
Undocumented |
Constant | ERR |
Undocumented |
Constant | ERR |
Undocumented |
Constant | ERR |
Undocumented |
Constant | ERR |
Undocumented |
Constant | ERR |
Undocumented |
Constant | ERR |
Undocumented |
Constant | ERR |
Undocumented |
Constant | ERR |
Undocumented |
Constant | ERR |
Undocumented |
Constant | ERR |
Undocumented |
Constant | ERR |
Undocumented |
Constant | ERR |
Undocumented |
Constant | ERR |
Undocumented |
Constant | ERR |
Undocumented |
Constant | ERR |
Undocumented |
Constant | ERR |
Undocumented |
Constant | ERR |
Undocumented |
Constant | ERR |
Undocumented |
Constant | ERR |
Undocumented |
Constant | ERR |
Undocumented |
Constant | ERR |
Undocumented |
Constant | ERR |
Undocumented |
Constant | ERR |
Undocumented |
Constant | ERR |
Undocumented |
Constant | ERR |
Undocumented |
Constant | ERR |
Undocumented |
Constant | ERR |
Undocumented |
Constant | ERR |
Undocumented |
Constant | ERR |
Undocumented |
Constant | ERR |
Undocumented |
Constant | ERR |
Undocumented |
Constant | ERR |
Undocumented |
Constant | ERR |
Undocumented |
Constant | ERR |
Undocumented |
Constant | ERR |
Undocumented |
Constant | ERR |
Undocumented |
Constant | ERR |
Undocumented |
Constant | ERR |
Undocumented |
Constant | M |
Undocumented |
Constant | MAX |
The maximum length of a command, as defined by RFC 2812 section 2.3. |
Constant | NL |
Undocumented |
Constant | NUL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | RPL |
Undocumented |
Constant | SPC |
Undocumented |
Constant | X |
Undocumented |
Constant | X |
Undocumented |
Variable | attributes |
Singleton instance of _CharacterAttributes , used for constructing formatted text information. |
Variable | m |
Undocumented |
Variable | m |
Undocumented |
Variable | m |
Undocumented |
Variable | numeric |
Undocumented |
Variable | symbolic |
Undocumented |
Variable | x |
Undocumented |
Variable | x |
Undocumented |
Variable | x |
Undocumented |
Class | _ |
Factory for character attributes, including foreground and background color and non-color attributes such as bold, reverse video and underline. |
Class | _ |
Dispatch commands to handlers based on their name. |
Class | _ |
A finite-state machine that parses formatted IRC text. |
Class | _ |
Formatting state/attributes of a single character. |
Function | _foldr |
Apply a function of two arguments cumulatively to the items of a sequence, from right to left, so as to reduce the sequence to a single value. |
Function | _int |
Convert a value to an integer if possible. |
Constant | _BOLD |
Undocumented |
Constant | _COLOR |
Undocumented |
Constant | _IRC |
Undocumented |
Constant | _IRC |
Undocumented |
Constant | _OFF |
Undocumented |
Constant | _REVERSE |
Undocumented |
Constant | _UNDERLINE |
Undocumented |
Assemble formatted text from structured information.
Currently handled formatting includes: bold, reverse, underline, mIRC color codes and the ability to remove all current formatting.
It is worth noting that assembled text will always begin with the control code to disable other attributes for the sake of correctness.
For example:
from twisted.words.protocols.irc import attributes as A assembleFormattedText( A.normal[A.bold['Time: '], A.fg.lightRed['Now!']])
Would produce "Time: " in bold formatting, followed by "Now!" with a foreground color of light red and without any additional formatting.
Available attributes are:
- bold
- reverseVideo
- underline
Available colors are:
- white
- black
- blue
- green
- light red
- red
- magenta
- orange
- yellow
- light green
- cyan
- light cyan
- light blue
- light magenta
- gray
- light gray
Parameters | |
formatted | Structured text and attributes. |
Returns | |
str | String containing mIRC control sequences that mimic those specified by formatted. |
See Also | |
http://www.mirc.co.uk/help/color.txt | |
Present Since | |
13.1 |
Extract CTCP data from a string.
Returns | |
A dict containing two keys:
|
Parameters | |
messages:a list of extended messages. An extended message is a (tag, data) tuple, where 'data' may be None , a string, or a list of strings to be joined with whitespace. | Undocumented |
Returns | |
String |
Parse text containing IRC formatting codes into structured information.
Color codes are mapped from 0 to 15 and wrap around if greater than 15.
Parameters | |
text:str | Formatted text to parse. |
Returns | |
Structured text and attributes. | |
Present Since | |
13.1 |
Parse an IRC mode string.
The mode string is parsed into two lists of mode changes (added and removed), with each mode change represented as (mode, param) where mode is the mode character, and param is the parameter passed for that mode, or None
if no parameter is required.
Parameters | |
modes:str | Modes string to parse. |
params:list | Parameters specified along with modes . |
param | A pair of strings ((add, remove)) that indicate which modes take parameters when added or removed. |
Returns | |
Two lists of mode changes, one for modes added and the other for modes removed respectively, mode changes in each list are represented as (mode, param). |
Split a string into multiple lines.
Whitespace near str[length] will be preferred as a breaking point. "\n" will also be used as a breaking point.
Parameters | |
str:str | The string to split. |
length:int | The maximum length which will be allowed for any string in the result. |
Returns | |
list of str |
Remove all formatting codes from text, leaving only the text.
Parameters | |
text:str | Formatted text to parse. |
Returns | |
str | Plain text without any control sequences. |
Present Since | |
13.1 |
Apply a function of two arguments cumulatively to the items of a sequence, from right to left, so as to reduce the sequence to a single value.
Parameters | |
f:callable taking 2 arguments | Undocumented |
z | Initial value. |
xs | Sequence to reduce. |
Returns | |
Single value resulting from reducing xs. |
Convert a value to an integer if possible.
Returns | |
int or type of default | An integer when value can be converted to an integer, otherwise return default |