Internet Relay Chat client protocol, with sprinkles.
In addition to providing an interface for an IRC client protocol,
this class also contains reasonable implementations of many common
CTCP methods.
TODO:
Login for IRCnets which require a PASS
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?)
Methods
|
|
|
|
__getstate__
|
__getstate__ ( self )
|
|
action
|
action (
self,
user,
channel,
data,
)
Called when I see a user perform an ACTION on a channel.
|
|
away
|
away ( self, message='' )
|
|
badMessage
|
badMessage (
self,
line,
excType,
excValue,
tb,
)
When I get a message that's so broken I can't use it.
|
|
connectionMade
|
connectionMade ( self )
|
|
ctcpMakeQuery
|
ctcpMakeQuery (
self,
user,
messages,
)
Send one or more extended messages as a CTCP query.
messages takes a list of extended messages.
An extended message is a (tag, data) tuple, where data may be
None.
|
|
ctcpMakeReply
|
ctcpMakeReply (
self,
user,
messages,
)
Send one or more extended messages as a CTCP reply.
messages takes a list of extended messages.
An extended message is a (tag, data) tuple, where data may be
None.
|
|
ctcpQuery
|
ctcpQuery (
self,
user,
channel,
messages,
)
Dispatch method for any CTCP queries received.
|
|
ctcpQuery_ACTION
|
ctcpQuery_ACTION (
self,
user,
channel,
data,
)
|
|
ctcpQuery_CLIENTINFO
|
ctcpQuery_CLIENTINFO (
self,
user,
channel,
data,
)
A master index of what CTCP tags this client knows.
If no arguments are provided, respond with a list of known tags.
If an argument is provided, provide human-readable help on
the usage of that tag.
|
|
ctcpQuery_DCC
|
ctcpQuery_DCC (
self,
user,
channel,
data,
)
Initiate a Direct Client Connection
Supported connection types: SEND, CHAT
Exceptions
|
|
IRCBadMessage, "Indecipherable address '%s'" %( address, )
IRCBadMessage, "malformed DCC request: %s" %( data, )
|
|
|
ctcpQuery_ERRMSG
|
ctcpQuery_ERRMSG (
self,
user,
channel,
data,
)
|
|
ctcpQuery_FINGER
|
ctcpQuery_FINGER (
self,
user,
channel,
data,
)
|
|
ctcpQuery_PING
|
ctcpQuery_PING (
self,
user,
channel,
data,
)
|
|
ctcpQuery_SOURCE
|
ctcpQuery_SOURCE (
self,
user,
channel,
data,
)
|
|
ctcpQuery_TIME
|
ctcpQuery_TIME (
self,
user,
channel,
data,
)
|
|
ctcpQuery_USERINFO
|
ctcpQuery_USERINFO (
self,
user,
channel,
data,
)
|
|
ctcpQuery_VERSION
|
ctcpQuery_VERSION (
self,
user,
channel,
data,
)
|
|
ctcpReply
|
ctcpReply (
self,
user,
channel,
messages,
)
Dispatch method for any CTCP replies received.
|
|
ctcpReply_PING
|
ctcpReply_PING (
self,
user,
channel,
data,
)
Exceptions
|
|
IRCBadMessage, "Bogus PING response from %s: %s" %( user, data )
|
|
|
ctcpUnknownQuery
|
ctcpUnknownQuery (
self,
user,
channel,
tag,
data,
)
|
|
ctcpUnknownReply
|
ctcpUnknownReply (
self,
user,
channel,
tag,
data,
)
Called when a fitting ctcpReply_ method is not found.
XXX: If the client makes arbitrary CTCP queries,
this method should probably show the responses to
them instead of treating them as anomolies.
|
|
dccSend
|
dccSend (
self,
user,
file,
)
Exceptions
|
|
NotImplementedError, ( "XXX!!! Help! I need to bind a socket, have it listen, and tell me its address. " "(and stop accepting once we've made a single connection.)" )
|
|
|
irc_ERR_NICKNAMEINUSE
|
irc_ERR_NICKNAMEINUSE (
self,
prefix,
params,
)
|
|
irc_ERR_PASSWDMISMATCH
|
irc_ERR_PASSWDMISMATCH (
self,
prefix,
params,
)
Exceptions
|
|
IRCPasswordMismatch( "Password Incorrect." )
|
|
|
irc_JOIN
|
irc_JOIN (
self,
prefix,
params,
)
|
|
irc_KICK
|
irc_KICK (
self,
prefix,
params,
)
Kicked? Who? Not me, I hope.
|
|
irc_NICK
|
irc_NICK (
self,
prefix,
params,
)
|
|
irc_NOTICE
|
irc_NOTICE (
self,
prefix,
params,
)
|
|
irc_PING
|
irc_PING (
self,
prefix,
params,
)
|
|
irc_PRIVMSG
|
irc_PRIVMSG (
self,
prefix,
params,
)
|
|
irc_RPL_WELCOME
|
irc_RPL_WELCOME (
self,
prefix,
params,
)
|
|
irc_unknown
|
irc_unknown (
self,
prefix,
command,
params,
)
|
|
join
|
join (
self,
channel,
key=None,
)
|
|
joined
|
joined ( self, channel )
Called when I finish joining a channel.
channel has the starting character (# or &) intact.
|
|
kickedFrom
|
kickedFrom (
self,
channel,
kicker,
message,
)
Called when I am kicked from a channel.
|
|
leave
|
leave (
self,
channel,
reason=None,
)
|
|
lineReceived
|
lineReceived ( self, line )
|
|
me
|
me (
self,
channel,
action,
)
Strike a pose.
|
|
msg
|
msg (
self,
user,
message,
length=None,
)
|
|
notice
|
notice (
self,
user,
message,
)
|
|
noticed
|
noticed (
self,
user,
channel,
message,
)
Called when I have a notice from a user to me or a channel.
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.
|
|
ping
|
ping ( self, user )
Measure round-trip delay to another IRC client.
|
|
pong
|
pong (
self,
user,
secs,
)
Called with the results of a CTCP PING query.
|
|
privmsg
|
privmsg (
self,
user,
channel,
message,
)
Called when I have a message from a user to me or a channel.
|
|
quirkyMessage
|
quirkyMessage ( self, s )
This is called when I receive a message which is peculiar,
but not wholly indecipherable.
|
|
reducingMsg
|
reducingMsg (
self,
fmt,
lines,
)
|
|
register
|
register (
self,
nickname,
hostname='foo',
servername='bar',
)
|
|
say
|
say (
self,
channel,
message,
length=None,
)
|
|
sendLine
|
sendLine ( self, line )
|
|
setNick
|
setNick ( self, nickname )
|
|
signedOn
|
signedOn ( self )
Called after sucessfully signing on to the server.
|
|
topic
|
topic (
self,
channel,
topic,
)
|
|
userKicked
|
userKicked (
self,
kickee,
channel,
kicker,
message,
)
|
|