t.w.p.i.IRCClient(basic.LineReceiver) : class documentation

Part of twisted.words.protocols.irc View Source View In Hierarchy

Known subclasses: twisted.words.im.ircsupport.IRCProto

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

Instance VariablesnicknameNickname the client will use.
passwordPassword used to log on to the server. May be None.
realnameSupplied to the server during login as the "Real name" or "ircname". May be None.
usernameSupplied to the server during login as the "User name". May be None
userinfoSent 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)."
fingerReplySent in reply to a FINGER CTCP query. If None, no FINGER reply will be sent. (type: Callable or String )
versionNameCTCP VERSION reply, client name. If None, no VERSION reply will be sent.
versionNumCTCP VERSION reply, client version,
versionEnvCTCP VERSION reply, environment the client is running in.
sourceURLCTCP SOURCE reply, a URL where the source code of this client may be found. If None, no SOURCE reply will be sent.
lineRateMinimum delay between lines sent to the server. If None, no delay will be imposed. (type: Number of Seconds. )
Method sendLine Sends a line to the other end of the connection.
Method created Called with creation date information about the server, usually at logon.
Method yourHost Called with daemon information about the server, usually at logon.
Method myInfo Called with information about the server, usually at logon.
Method luserClient Called with information about the number of connections, usually at logon.
Method bounce Called with information about where the client should reconnect.
Method isupport Called with various information about what the server supports.
Method luserChannels Called with the number of channels existant on the server.
Method luserOp Called with the number of ops logged on to the server.
Method luserMe Called with information about the server connected to.
Method privmsg Called when I have a message from a user to me or a channel.
Method joined Called when I finish joining a channel.
Method left Called when I have left a channel.
Method noticed Called when I have a notice from a user to me or a channel.
Method modeChanged Called when a channel's modes are changed
Method pong Called with the results of a CTCP PING query.
Method signedOn Called after sucessfully signing on to the server.
Method kickedFrom Called when I am kicked from a channel.
Method nickChanged Called when my nick has been changed.
Method userJoined Called when I see another user joining a channel.
Method userLeft Called when I see another user leaving a channel.
Method userQuit Called when I see another user disconnect from the network.
Method userKicked Called when I observe someone else being kicked from a channel.
Method action Called when I see a user perform an ACTION on a channel.
Method topicUpdated In channel, user changed the topic to newTopic.
Method userRenamed A user changed their name from oldname to newname.
Method receivedMOTD I received a message-of-the-day banner from the server.
Method join Undocumented
Method leave Undocumented
Method kick Undocumented
Method topic Attempt to set the topic of the given channel, or ask what it is.
Method mode Change the modes on a user or channel.
Method say Undocumented
Method msg Send a message to a user or channel.
Method notice Undocumented
Method away Undocumented
Method register Undocumented
Method setNick Undocumented
Method quit Undocumented
Method me Strike a pose.
Method ping Measure round-trip delay to another IRC client.
Method dccSend Undocumented
Method dccResume Send a DCC RESUME request to another user.
Method dccAcceptResume Send a DCC ACCEPT response to clients who have requested a resume.
Method irc_ERR_NICKNAMEINUSE Undocumented
Method irc_ERR_PASSWDMISMATCH Undocumented
Method irc_RPL_WELCOME Undocumented
Method irc_JOIN Undocumented
Method irc_PART Undocumented
Method irc_QUIT Undocumented
Method irc_MODE Undocumented
Method irc_PING Undocumented
Method irc_PRIVMSG Undocumented
Method irc_NOTICE Undocumented
Method irc_NICK Undocumented
Method irc_KICK Kicked? Who? Not me, I hope.
Method irc_TOPIC Someone in the channel set the topic.
Method irc_RPL_TOPIC I just joined the channel, and the server is telling me the current topic.
Method irc_RPL_NOTOPIC Undocumented
Method irc_RPL_MOTDSTART Undocumented
Method irc_RPL_MOTD Undocumented
Method irc_RPL_ENDOFMOTD Undocumented
Method irc_RPL_CREATED Undocumented
Method irc_RPL_YOURHOST Undocumented
Method irc_RPL_MYINFO Undocumented
Method irc_RPL_BOUNCE Undocumented
Method irc_RPL_LUSERCLIENT Undocumented
Method irc_RPL_LUSEROP Undocumented
Method irc_RPL_LUSERCHANNELS Undocumented
Method irc_RPL_LUSERME Undocumented
Method irc_unknown Undocumented
Method ctcpQuery Dispatch method for any CTCP queries received.
Method ctcpQuery_ACTION Undocumented
Method ctcpQuery_PING Undocumented
Method ctcpQuery_FINGER Undocumented
Method ctcpQuery_VERSION Undocumented
Method ctcpQuery_SOURCE Undocumented
Method ctcpQuery_USERINFO Undocumented
Method ctcpQuery_CLIENTINFO A master index of what CTCP tags this client knows.
Method ctcpQuery_ERRMSG Undocumented
Method ctcpQuery_TIME Undocumented
Method ctcpQuery_DCC Initiate a Direct Client Connection
Method dcc_SEND Undocumented
Method dcc_ACCEPT Undocumented
Method dcc_RESUME Undocumented
Method dcc_CHAT Undocumented
Method dccDoSend Called when I receive a DCC SEND offer from a client.
Method dccDoResume Called when a client is trying to resume an offered file via DCC send. It should be either replied to with a DCC ACCEPT or ignored (default).
Method dccDoAcceptResume Called when a client has verified and accepted a DCC resume request made by us. By default it will do nothing.
Method dccDoChat Undocumented
Method ctcpUnknownQuery Undocumented
Method ctcpMakeReply Send one or more extended messages as a CTCP reply.
Method ctcpMakeQuery Send one or more extended messages as a CTCP query.
Method ctcpReply Dispatch method for any CTCP replies received.
Method ctcpReply_PING Undocumented
Method ctcpUnknownReply Called when a fitting ctcpReply_ method is not found.
Method badMessage When I get a message that's so broken I can't use it.
Method quirkyMessage This is called when I receive a message which is peculiar, but not wholly indecipherable.
Method connectionMade Called when a connection is made.
Method dataReceived Protocol.dataReceived. Translates bytes into lines, and calls lineReceived (or rawDataReceived, depending on mode.)
Method lineReceived Override this for when each line is received.
Method handleCommand Determine the function to call for the given command and call it with the given arguments.
Method __getstate__ Undocumented
Method _reallySendLine Undocumented
Method _sendLine Undocumented

Inherited from LineReceiver:

Method clearLineBuffer Clear buffered data.
Method setLineMode Sets the line-mode of this receiver.
Method setRawMode Sets the raw mode of this receiver. Further data received will be sent to rawDataReceived rather than lineReceived.
Method rawDataReceived Override this for when raw data is received.
Method lineLengthExceeded Called when the maximum line length has been reached. Override if it needs to be dealt with in some special way.

Inherited from Protocol (via LineReceiver):

Method connectionLost Called when the connection is shut down.

Inherited from BaseProtocol (via LineReceiver, Protocol):

Method makeConnection Make a connection to a transport and a server.

Inherited from _PauseableMixin (via LineReceiver):

Method pauseProducing Undocumented
Method resumeProducing Undocumented
Method stopProducing Undocumented
def _reallySendLine(self, line): (source)
Undocumented
def sendLine(self, line): (source)
Sends a line to the other end of the connection.
def _sendLine(self): (source)
Undocumented
def created(self, when): (source)
Called with creation date information about the server, usually at logon.
ParameterswhenA string describing when the server was created, probably. (type: str )
def yourHost(self, info): (source)
Called with daemon information about the server, usually at logon.
Parametersinfo (type: str )
whenA string describing what software the server is running, probably.
def myInfo(self, servername, version, umodes, cmodes): (source)
Called with information about the server, usually at logon.
ParametersservernameThe hostname of this server. (type: str )
versionA description of what software this server runs. (type: str )
umodesAll the available user modes. (type: str )
cmodesAll the available channel modes. (type: str )
def luserClient(self, info): (source)
Called with information about the number of connections, usually at logon.
ParametersinfoA description of the number of clients and servers connected to the network, probably. (type: str )
def bounce(self, info): (source)
Called with information about where the client should reconnect.
ParametersinfoA plaintext description of the address that should be connected to. (type: str )
def isupport(self, options): (source)
Called with various information about what the server supports.
ParametersoptionsDescriptions of features or limits of the server, possibly in the form "NAME=VALUE". (type: list of str )
def luserChannels(self, channels): (source)
Called with the number of channels existant on the server.
Parameterschannels (type: int )
def luserOp(self, ops): (source)
Called with the number of ops logged on to the server.
Parametersops (type: int )
def luserMe(self, info): (source)
Called with information about the server connected to.
ParametersinfoA plaintext string describing the number of users and servers connected to this server. (type: str )
def privmsg(self, user, channel, message): (source)
Called when I have a message from a user to me or a channel.
def joined(self, channel): (source)

Called when I finish joining a channel.

channel has the starting character (# or &) intact.
def left(self, channel): (source)

Called when I have left a channel.

channel has the starting character (# or &) intact.
def noticed(self, user, channel, message): (source)

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.
def modeChanged(self, user, channel, set, modes, args): (source)
Called when a channel's modes are changed
ParametersuserThe user and hostmask which instigated this change. (type: str )
channelThe channel for which the modes are changing. (type: str )
settrue if the mode is being added, false if it is being removed. (type: bool or int )
modesThe mode or modes which are being changed. (type: str )
argsAny additional information required for the mode change. (type: tuple )
def pong(self, user, secs): (source)
Called with the results of a CTCP PING query.
def signedOn(self): (source)
Called after sucessfully signing on to the server.
def kickedFrom(self, channel, kicker, message): (source)
Called when I am kicked from a channel.
def nickChanged(self, nick): (source)
Called when my nick has been changed.
def userJoined(self, user, channel): (source)
Called when I see another user joining a channel.
def userLeft(self, user, channel): (source)
Called when I see another user leaving a channel.
def userQuit(self, user, quitMessage): (source)
Called when I see another user disconnect from the network.
def userKicked(self, kickee, channel, kicker, message): (source)
Called when I observe someone else being kicked from a channel.
def action(self, user, channel, data): (source)
Called when I see a user perform an ACTION on a channel.
def topicUpdated(self, user, channel, newTopic): (source)

In channel, user changed the topic to newTopic.

Also called when first joining a channel.
def userRenamed(self, oldname, newname): (source)
A user changed their name from oldname to newname.
def receivedMOTD(self, motd): (source)

I received a message-of-the-day banner from the server.

motd is a list of strings, where each string was sent as a seperate message from the server. To display, you might want to use:
   string.join(motd, '\n')
to get a nicely formatted string.
def join(self, channel, key=None): (source)
Undocumented
def leave(self, channel, reason=None): (source)
Undocumented
def kick(self, channel, user, reason=None): (source)
Undocumented
def topic(self, channel, topic=None): (source)

Attempt to set the topic of the given channel, or ask what it is.

If topic is None, then I sent a topic query instead of trying to set the topic. The server should respond with a TOPIC message containing the current topic of the given channel.
def mode(self, chan, set, modes, limit=None, user=None, mask=None): (source)
Change the modes on a user or channel.
def say(self, channel, message, length=None): (source)
Undocumented
def msg(self, user, message, length=None): (source)
Send a message to a user or channel.
ParametersuserThe username or channel name to which to direct the message. (type: str )
messageThe text to send (type: str )
lengthThe 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 )
def notice(self, user, message): (source)
Undocumented
def away(self, message=''): (source)
Undocumented
def register(self, nickname, hostname='foo', servername='bar'): (source)
Undocumented
def setNick(self, nickname): (source)
Undocumented
def quit(self, message=''): (source)
Undocumented
def me(self, channel, action): (source)
Strike a pose.
def ping(self, user, text=None): (source)
Measure round-trip delay to another IRC client.
def dccSend(self, user, file): (source)
Undocumented
def dccResume(self, user, fileName, port, resumePos): (source)
Send a DCC RESUME request to another user.
def dccAcceptResume(self, user, fileName, port, resumePos): (source)
Send a DCC ACCEPT response to clients who have requested a resume.
def irc_ERR_NICKNAMEINUSE(self, prefix, params): (source)
Undocumented
def irc_ERR_PASSWDMISMATCH(self, prefix, params): (source)
Undocumented
def irc_RPL_WELCOME(self, prefix, params): (source)
Undocumented
def irc_JOIN(self, prefix, params): (source)
Undocumented
def irc_PART(self, prefix, params): (source)
Undocumented
def irc_QUIT(self, prefix, params): (source)
Undocumented
def irc_MODE(self, prefix, params): (source)
Undocumented
def irc_PING(self, prefix, params): (source)
Undocumented
def irc_PRIVMSG(self, prefix, params): (source)
Undocumented
def irc_NOTICE(self, prefix, params): (source)
Undocumented
def irc_NICK(self, prefix, params): (source)
Undocumented
def irc_KICK(self, prefix, params): (source)
Kicked? Who? Not me, I hope.
def irc_TOPIC(self, prefix, params): (source)
Someone in the channel set the topic.
def irc_RPL_TOPIC(self, prefix, params): (source)
I just joined the channel, and the server is telling me the current topic.
def irc_RPL_NOTOPIC(self, prefix, params): (source)
Undocumented
def irc_RPL_MOTDSTART(self, prefix, params): (source)
Undocumented
def irc_RPL_MOTD(self, prefix, params): (source)
Undocumented
def irc_RPL_ENDOFMOTD(self, prefix, params): (source)
Undocumented
def irc_RPL_CREATED(self, prefix, params): (source)
Undocumented
def irc_RPL_YOURHOST(self, prefix, params): (source)
Undocumented
def irc_RPL_MYINFO(self, prefix, params): (source)
Undocumented
def irc_RPL_BOUNCE(self, prefix, params): (source)
Undocumented
def irc_RPL_LUSERCLIENT(self, prefix, params): (source)
Undocumented
def irc_RPL_LUSEROP(self, prefix, params): (source)
Undocumented
def irc_RPL_LUSERCHANNELS(self, prefix, params): (source)
Undocumented
def irc_RPL_LUSERME(self, prefix, params): (source)
Undocumented
def irc_unknown(self, prefix, command, params): (source)
Undocumented
def ctcpQuery(self, user, channel, messages): (source)
Dispatch method for any CTCP queries received.
def ctcpQuery_ACTION(self, user, channel, data): (source)
Undocumented
def ctcpQuery_PING(self, user, channel, data): (source)
Undocumented
def ctcpQuery_FINGER(self, user, channel, data): (source)
Undocumented
def ctcpQuery_VERSION(self, user, channel, data): (source)
Undocumented
def ctcpQuery_SOURCE(self, user, channel, data): (source)
Undocumented
def ctcpQuery_USERINFO(self, user, channel, data): (source)
Undocumented
def ctcpQuery_CLIENTINFO(self, user, channel, data): (source)

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.
def ctcpQuery_ERRMSG(self, user, channel, data): (source)
Undocumented
def ctcpQuery_TIME(self, user, channel, data): (source)
Undocumented
def ctcpQuery_DCC(self, user, channel, data): (source)
Initiate a Direct Client Connection
def dcc_SEND(self, user, channel, data): (source)
Undocumented
def dcc_ACCEPT(self, user, channel, data): (source)
Undocumented
def dcc_RESUME(self, user, channel, data): (source)
Undocumented
def dcc_CHAT(self, user, channel, data): (source)
Undocumented
def dccDoSend(self, user, address, port, fileName, size, data): (source)

Called when I receive a DCC SEND offer from a client.

By default, I do nothing here.
def dccDoResume(self, user, file, port, resumePos): (source)
Called when a client is trying to resume an offered file via DCC send. It should be either replied to with a DCC ACCEPT or ignored (default).
def dccDoAcceptResume(self, user, file, port, resumePos): (source)
Called when a client has verified and accepted a DCC resume request made by us. By default it will do nothing.
def dccDoChat(self, user, channel, address, port, data): (source)
Undocumented
def ctcpUnknownQuery(self, user, channel, tag, data): (source)
Undocumented
def ctcpMakeReply(self, user, messages): (source)
Send one or more extended messages as a CTCP reply.
Parametersmessages (type: a list of extended messages. An extended message is a (tag, data) tuple, where 'data' may be None. )
def ctcpMakeQuery(self, user, messages): (source)
Send one or more extended messages as a CTCP query.
Parametersmessages (type: a list of extended messages. An extended message is a (tag, data) tuple, where 'data' may be None. )
def ctcpReply(self, user, channel, messages): (source)
Dispatch method for any CTCP replies received.
def ctcpReply_PING(self, user, channel, data): (source)
Undocumented
def ctcpUnknownReply(self, user, channel, tag, data): (source)

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.
def badMessage(self, line, excType, excValue, tb): (source)
When I get a message that's so broken I can't use it.
def quirkyMessage(self, s): (source)
This is called when I receive a message which is peculiar, but not wholly indecipherable.
def connectionMade(self): (source)

Called when a connection is made.

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.
def dataReceived(self, data): (source)
Protocol.dataReceived. Translates bytes into lines, and calls lineReceived (or rawDataReceived, depending on mode.)
def lineReceived(self, line): (source)
Override this for when each line is received.
def handleCommand(self, command, prefix, params): (source)
Determine the function to call for the given command and call it with the given arguments.
def __getstate__(self): (source)
Undocumented
API Documentation for Twisted, generated by pydoctor at 2011-10-27 15:57:47.