In addition to providing an interface for an IRC client protocol, this
class also contains reasonable implementations of many common CTCP
methods.

TODO

Limit the length of messages sent (because the IRC server probably
does).

Add flood protection/rate limiting for my CTCP replies.

NickServ cooperation. (a mix-in?)

Heartbeat. The transport may die in such a way that it does not
realize it is dead until it is written to. Sending something (like
"PING this.irc-host.net") during idle peroids would
alleviate that. If you're concerned with the stability of the host
as well as that of the transport, you might care to watch for the
corresponding PONG.

Instance Variables

nickname

Nickname the client will use.

password

Password used to log on to the server. May be None.

realname

Supplied to the server during login as the "Real name" or
"ircname". May be None.

username

Supplied to the server during login as the "User name". May be
None

userinfo

Sent in reply to a USERINFO CTCP query. If None, no
USERINFO reply will be sent. "This is used to transmit a string which
is settable by the user (and never should be set by the client)."

fingerReply

Sent in reply to a FINGER CTCP query. If None, no FINGER
reply will be sent.
(type: Callable or String
)

versionName

CTCP VERSION reply, client name. If None, no VERSION reply
will be sent.

versionNum

CTCP VERSION reply, client version,

versionEnv

CTCP VERSION reply, environment the client is running in.

sourceURL

CTCP SOURCE reply, a URL where the source code of this client may be
found. If None, no SOURCE reply will be sent.

lineRate

Minimum delay between lines sent to the server. If None,
no delay will be imposed.
(type: Number of Seconds.
)

By default, this is equivalent to IRCClient.privmsg, but if your client
makes any automated replies, you must override this! From the RFC:

The difference between NOTICE and PRIVMSG is that
automatic replies MUST NEVER be sent in response to a
NOTICE message. [...] The object of this rule is to avoid
loops between clients automatically sending something in
response to something it received.

The username or channel name to which to direct the message.
(type: str
)

message

The text to send
(type: str
)

length

The maximum number of octets to send at a time. This has the effect of
turning a single call to msg() into multiple commands to the server. This
is useful when long messages may be sent that would otherwise cause the
server to kick us off or silently truncate the text we are sending. If
None is passed, the entire message is always send in one command.
(type: int
)

This may be considered the initializer of the protocol, because it is
called when the connection is completed. For clients, this is called once
the connection to the server has been established; for servers, this is
called after an accept() call stops blocking and a socket has been
received. If you need to send any greeting or initial message, do it
here.