Class t.w.p.i.IRCClient(basic.LineReceiver):

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. )

Split Table into Classes Show Methods in One Table

Line # Kind Name Docs
579 Method sendLine Sends a line to the other end of the connection.
602 Method created Called with creation date information about the server, usually at logon.
609 Method yourHost Called with daemon information about the server, usually at logon.
616 Method myInfo Called with information about the server, usually at logon.
632 Method luserClient Called with information about the number of connections, usually at logon.
640 Method bounce Called with information about where the client should reconnect.
648 Method isupport Called with various information about what the server supports.
656 Method luserChannels Called with the number of channels existant on the server.
662 Method luserOp Called with the number of ops logged on to the server.
668 Method luserMe Called with information about the server connected to.
678 Method privmsg Called when I have a message from a user to me or a channel.
683 Method joined Called when I finish joining a channel.
690 Method left Called when I have left a channel.
697 Method noticed Called when I have a notice from a user to me or a channel.
712 Method modeChanged Called when users or channel's modes are changed.
738 Method pong Called with the results of a CTCP PING query.
743 Method signedOn Called after sucessfully signing on to the server.
748 Method kickedFrom Called when I am kicked from a channel.
753 Method nickChanged Called when my nick has been changed.
761 Method userJoined Called when I see another user joining a channel.
766 Method userLeft Called when I see another user leaving a channel.
771 Method userQuit Called when I see another user disconnect from the network.
776 Method userKicked Called when I observe someone else being kicked from a channel.
781 Method action Called when I see a user perform an ACTION on a channel.
786 Method topicUpdated In channel, user changed the topic to newTopic.
793 Method userRenamed A user changed their name from oldname to newname.
800 Method receivedMOTD I received a message-of-the-day banner from the server.
815 Method join Join a channel.
831 Method leave Leave a channel.
847 Method kick Attempt to kick a user from a channel.
867 Method topic Attempt to set the topic of the given channel, or ask what it is.
887 Method mode Change the modes on a user or channel.
923 Method say Send a message to a channel
943 Method msg Send a message to a user or channel.
978 Method notice Send a notice to a user.
992 Method away Mark this client as away.
1003 Method back Clear the away status.
1011 Method whois Retrieve user information about the given nick name.
1026 Method register Login to the server.
1044 Method setNick Set this client's nickname.
1054 Method quit Disconnect from the server
1067 Method me Strike a pose.
1083 Method ping Measure round-trip delay to another IRC client.
1106 Method dccSend Undocumented
1132 Method dccResume Send a DCC RESUME request to another user.
1137 Method dccAcceptResume Send a DCC ACCEPT response to clients who have requested a resume.
1147 Method irc_ERR_NICKNAMEINUSE Called when we try to register an invalid nickname.
1153 Method irc_ERR_PASSWDMISMATCH Called when the login was incorrect.
1159 Method irc_RPL_WELCOME Called when we have received the welcome from the server.
1165 Method irc_JOIN Called when a user joins a channel.
1176 Method irc_PART Called when a user leaves a channel.
1187 Method irc_QUIT Called when a user has quit.
1195 Method irc_MODE Parse the server message when one or more modes are changed
1231 Method irc_PING Called when some has pinged us.
1237 Method irc_PRIVMSG Called when we get a message.
1259 Method irc_NOTICE Called when a user gets a notice.
1279 Method irc_NICK Called when a user changes their nickname.
1289 Method irc_KICK Called when a user is kicked from a channel.
1303 Method irc_TOPIC Someone in the channel set the topic.
1312 Method irc_RPL_TOPIC Called when the topic for a channel is initially reported or when it
1322 Method irc_RPL_NOTOPIC Undocumented
1328 Method irc_RPL_MOTDSTART Undocumented
1333 Method irc_RPL_MOTD Undocumented
1338 Method irc_RPL_ENDOFMOTD Undocumented
1341 Method irc_RPL_CREATED Undocumented
1344 Method irc_RPL_YOURHOST Undocumented
1347 Method irc_RPL_MYINFO Undocumented
1353 Method irc_RPL_BOUNCE Undocumented
1360 Method irc_RPL_LUSERCLIENT Undocumented
1363 Method irc_RPL_LUSEROP Undocumented
1369 Method irc_RPL_LUSERCHANNELS Undocumented
1375 Method irc_RPL_LUSERME Undocumented
1378 Method irc_unknown Undocumented
1384 Method ctcpQuery Dispatch method for any CTCP queries received.
1394 Method ctcpQuery_ACTION Undocumented
1397 Method ctcpQuery_PING Undocumented
1401 Method ctcpQuery_FINGER Undocumented
1416 Method ctcpQuery_VERSION Undocumented
1428 Method ctcpQuery_SOURCE Undocumented
1441 Method ctcpQuery_USERINFO Undocumented
1449 Method ctcpQuery_CLIENTINFO A master index of what CTCP tags this client knows.
1480 Method ctcpQuery_ERRMSG Undocumented
1487 Method ctcpQuery_TIME Undocumented
1496 Method ctcpQuery_DCC Initiate a Direct Client Connection
1516 Method dcc_SEND Undocumented
1540 Method dcc_ACCEPT Undocumented
1553 Method dcc_RESUME Undocumented
1565 Method dcc_CHAT Undocumented
1583 Method dccDoSend Called when I receive a DCC SEND offer from a client.
1594 Method dccDoResume Called when a client is trying to resume an offered file
1600 Method dccDoAcceptResume Called when a client has verified and accepted a DCC resume
1605 Method dccDoChat Undocumented
1618 Method ctcpUnknownQuery Undocumented
1627 Method ctcpMakeReply Send one or more extended messages as a CTCP reply.
1638 Method ctcpMakeQuery Send one or more extended messages as a CTCP query.
1650 Method ctcpReply Dispatch method for any CTCP replies received.
1661 Method ctcpReply_PING Undocumented
1670 Method ctcpUnknownReply Called when a fitting ctcpReply_ method is not found.
1683 Method badMessage When I get a message that's so broken I can't use it.
1691 Method quirkyMessage This is called when I receive a message which is peculiar,
1699 Method connectionMade Called when a connection is made.
1704 Method dataReceived Protocol.dataReceived.
1707 Method lineReceived Override this for when each line is received.
1718 Method handleCommand Determine the function to call for the given command and call
1732 Method __getstate__ Undocumented
576 Method _reallySendLine Undocumented
587 Method _sendLine Undocumented

Inherited from LineReceiver:

Line # Kind Name Docs
207 Method clearLineBuffer Clear buffered data.
241 Method setLineMode Sets the line-mode of this receiver.
256 Method setRawMode Sets the raw mode of this receiver.
263 Method rawDataReceived Override this for when raw data is received.
278 Method lineLengthExceeded Called when the maximum line length has been reached.

Inherited from Protocol (via LineReceiver):

Line # Kind Name Docs
384 Method connectionLost Called when the connection is shut down.

Inherited from BaseProtocol (via LineReceiver, Protocol):

Line # Kind Name Docs
341 Method makeConnection Make a connection to a transport and a server.

Inherited from _PauseableMixin (via LineReceiver):

Line # Kind Name Docs
172 Method pauseProducing Undocumented
176 Method resumeProducing Undocumented
181 Method stopProducing Undocumented
Line # Kind Name Docs
1732 Method __getstate__ Undocumented
781 Method action Called when I see a user perform an ACTION on a channel.
992 Method away Mark this client as away.
1003 Method back Clear the away status.
1683 Method badMessage When I get a message that's so broken I can't use it.
640 Method bounce Called with information about where the client should reconnect.
207 Method clearLineBuffer Clear buffered data.
384 Method connectionLost Called when the connection is shut down.
1699 Method connectionMade Called when a connection is made.
602 Method created Called with creation date information about the server, usually at logon.
1638 Method ctcpMakeQuery Send one or more extended messages as a CTCP query.
1627 Method ctcpMakeReply Send one or more extended messages as a CTCP reply.
1384 Method ctcpQuery Dispatch method for any CTCP queries received.
1394 Method ctcpQuery_ACTION Undocumented
1449 Method ctcpQuery_CLIENTINFO A master index of what CTCP tags this client knows.
1496 Method ctcpQuery_DCC Initiate a Direct Client Connection
1480 Method ctcpQuery_ERRMSG Undocumented
1401 Method ctcpQuery_FINGER Undocumented
1397 Method ctcpQuery_PING Undocumented
1428 Method ctcpQuery_SOURCE Undocumented
1487 Method ctcpQuery_TIME Undocumented
1441 Method ctcpQuery_USERINFO Undocumented
1416 Method ctcpQuery_VERSION Undocumented
1650 Method ctcpReply Dispatch method for any CTCP replies received.
1661 Method ctcpReply_PING Undocumented
1618 Method ctcpUnknownQuery Undocumented
1670 Method ctcpUnknownReply Called when a fitting ctcpReply_ method is not found.
1704 Method dataReceived Protocol.dataReceived.
1540 Method dcc_ACCEPT Undocumented
1565 Method dcc_CHAT Undocumented
1553 Method dcc_RESUME Undocumented
1516 Method dcc_SEND Undocumented
1137 Method dccAcceptResume Send a DCC ACCEPT response to clients who have requested a resume.
1600 Method dccDoAcceptResume Called when a client has verified and accepted a DCC resume
1605 Method dccDoChat Undocumented
1594 Method dccDoResume Called when a client is trying to resume an offered file
1583 Method dccDoSend Called when I receive a DCC SEND offer from a client.
1132 Method dccResume Send a DCC RESUME request to another user.
1106 Method dccSend Undocumented
1718 Method handleCommand Determine the function to call for the given command and call
1147 Method irc_ERR_NICKNAMEINUSE Called when we try to register an invalid nickname.
1153 Method irc_ERR_PASSWDMISMATCH Called when the login was incorrect.
1165 Method irc_JOIN Called when a user joins a channel.
1289 Method irc_KICK Called when a user is kicked from a channel.
1195 Method irc_MODE Parse the server message when one or more modes are changed
1279 Method irc_NICK Called when a user changes their nickname.
1259 Method irc_NOTICE Called when a user gets a notice.
1176 Method irc_PART Called when a user leaves a channel.
1231 Method irc_PING Called when some has pinged us.
1237 Method irc_PRIVMSG Called when we get a message.
1187 Method irc_QUIT Called when a user has quit.
1353 Method irc_RPL_BOUNCE Undocumented
1341 Method irc_RPL_CREATED Undocumented
1338 Method irc_RPL_ENDOFMOTD Undocumented
1369 Method irc_RPL_LUSERCHANNELS Undocumented
1360 Method irc_RPL_LUSERCLIENT Undocumented
1375 Method irc_RPL_LUSERME Undocumented
1363 Method irc_RPL_LUSEROP Undocumented
1333 Method irc_RPL_MOTD Undocumented
1328 Method irc_RPL_MOTDSTART Undocumented
1347 Method irc_RPL_MYINFO Undocumented
1322 Method irc_RPL_NOTOPIC Undocumented
1312 Method irc_RPL_TOPIC Called when the topic for a channel is initially reported or when it
1159 Method irc_RPL_WELCOME Called when we have received the welcome from the server.
1344 Method irc_RPL_YOURHOST Undocumented
1303 Method irc_TOPIC Someone in the channel set the topic.
1378 Method irc_unknown Undocumented
648 Method isupport Called with various information about what the server supports.
815 Method join Join a channel.
683 Method joined Called when I finish joining a channel.
847 Method kick Attempt to kick a user from a channel.
748 Method kickedFrom Called when I am kicked from a channel.
831 Method leave Leave a channel.
690 Method left Called when I have left a channel.
278 Method lineLengthExceeded Called when the maximum line length has been reached.
1707 Method lineReceived Override this for when each line is received.
656 Method luserChannels Called with the number of channels existant on the server.
632 Method luserClient Called with information about the number of connections, usually at logon.
668 Method luserMe Called with information about the server connected to.
662 Method luserOp Called with the number of ops logged on to the server.
341 Method makeConnection Make a connection to a transport and a server.
1067 Method me Strike a pose.
887 Method mode Change the modes on a user or channel.
712 Method modeChanged Called when users or channel's modes are changed.
943 Method msg Send a message to a user or channel.
616 Method myInfo Called with information about the server, usually at logon.
753 Method nickChanged Called when my nick has been changed.
978 Method notice Send a notice to a user.
697 Method noticed Called when I have a notice from a user to me or a channel.
172 Method pauseProducing Undocumented
1083 Method ping Measure round-trip delay to another IRC client.
738 Method pong Called with the results of a CTCP PING query.
678 Method privmsg Called when I have a message from a user to me or a channel.
1691 Method quirkyMessage This is called when I receive a message which is peculiar,
1054 Method quit Disconnect from the server
263 Method rawDataReceived Override this for when raw data is received.
800 Method receivedMOTD I received a message-of-the-day banner from the server.
1026 Method register Login to the server.
176 Method resumeProducing Undocumented
923 Method say Send a message to a channel
579 Method sendLine Sends a line to the other end of the connection.
241 Method setLineMode Sets the line-mode of this receiver.
1044 Method setNick Set this client's nickname.
256 Method setRawMode Sets the raw mode of this receiver.
743 Method signedOn Called after sucessfully signing on to the server.
181 Method stopProducing Undocumented
867 Method topic Attempt to set the topic of the given channel, or ask what it is.
786 Method topicUpdated In channel, user changed the topic to newTopic.
761 Method userJoined Called when I see another user joining a channel.
776 Method userKicked Called when I observe someone else being kicked from a channel.
766 Method userLeft Called when I see another user leaving a channel.
771 Method userQuit Called when I see another user disconnect from the network.
793 Method userRenamed A user changed their name from oldname to newname.
1011 Method whois Retrieve user information about the given nick name.
609 Method yourHost Called with daemon information about the server, usually at logon.
576 Method _reallySendLine Undocumented
587 Method _sendLine 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 users or channel's modes are changed.
ParametersuserThe user and hostmask which instigated this change. (type: str )
channelThe channel where the modes are changed. If args is empty the channel for which the modes are changing. If the changes are at server level it could be equal to user. (type: str )
setTrue if the mode(s) is being added, False if it is being removed. If some modes are added and others removed at the same time this function will be called twice, the first time with all the added modes, the second with the removed ones. (To change this behaviour override the irc_MODE method) (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:
   '\n'.join(motd)
to get a nicely formatted string.
def join(self, channel, key=None): (source)
Join a channel.
ParameterschannelThe name of the channel to join. If it has no prefix, '#' will to prepended to it. (type: str )
keyIf specified, the key used to join the channel. (type: str )
def leave(self, channel, reason=None): (source)
Leave a channel.
ParameterschannelThe name of the channel to leave. If it has no prefix, '#' will to prepended to it. (type: str )
reasonIf given, the reason for leaving. (type: str )
def kick(self, channel, user, reason=None): (source)
Attempt to kick a user from a channel.
ParameterschannelThe name of the channel to kick the user from. If it has no prefix, '#' will to prepended to it. (type: str )
userThe nick of the user to kick. (type: str )
reasonIf given, the reason for kicking the user. (type: str )
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.
ParameterschannelThe name of the channel to change the topic on. If it has no prefix, '#' will to prepended to it. (type: str )
topicIf specified, what to set the topic to. (type: str )
def mode(self, chan, set, modes, limit=None, user=None, mask=None): (source)

Change the modes on a user or channel.

The limit, user, and mask parameters are mutually exclusive.
ParameterschanThe name of the channel to operate on. If it has no prefix, '#' will to prepended to it. (type: str )
setTrue to give the user or channel permissions and False to remove them. (type: bool )
modesThe mode flags to set on the user or channel. (type: str )
limitIn conjuction with the 'l' mode flag, limits the number of users on the channel. (type: int )
userThe user to change the mode on. (type: str )
maskIn conjuction with the 'b' mode flag, sets a mask of users to be banned from the channel. (type: str )
def say(self, channel, message, length=None): (source)
Send a message to a channel
ParameterschannelThe channel to say the message on. (type: str )
messageThe message to say. (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 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)

Send a notice to a user.

Notices are like normal message, but should never get automated replies.
ParametersuserThe user to send a notice to. (type: str )
messageThe contents of the notice to send. (type: str )
def away(self, message=''): (source)
Mark this client as away.
ParametersmessageIf specified, the away message. (type: str )
def back(self): (source)
Clear the away status.
def whois(self, nickname, server=None): (source)
Retrieve user information about the given nick name.
ParametersnicknameThe nick name about which to retrieve information. (type: str )
Present Since8.2
def register(self, nickname, hostname='foo', servername='bar'): (source)
Login to the server.
ParametersnicknameThe nickname to register. (type: str )
hostnameIf specified, the hostname to logon as. (type: str )
servernameIf specified, the servername to logon as. (type: str )
def setNick(self, nickname): (source)
Set this client's nickname.
ParametersnicknameThe nickname to change to. (type: str )
def quit(self, message=''): (source)
Disconnect from the server
ParametersmessageIf specified, the message to give when quitting the server. (type: str )
def me(self, channel, action): (source)
Strike a pose.
ParameterschannelThe name of the channel to have an action on. If it has no prefix, '#' will to prepended to it. (type: str )
actionThe action to preform. (type: str )
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)
Called when we try to register an invalid nickname.
def irc_ERR_PASSWDMISMATCH(self, prefix, params): (source)
Called when the login was incorrect.
def irc_RPL_WELCOME(self, prefix, params): (source)
Called when we have received the welcome from the server.
def irc_JOIN(self, prefix, params): (source)
Called when a user joins a channel.
def irc_PART(self, prefix, params): (source)
Called when a user leaves a channel.
def irc_QUIT(self, prefix, params): (source)
Called when a user has quit.
def irc_MODE(self, prefix, params): (source)
Parse the server message when one or more modes are changed
def irc_PING(self, prefix, params): (source)
Called when some has pinged us.
def irc_PRIVMSG(self, prefix, params): (source)
Called when we get a message.
def irc_NOTICE(self, prefix, params): (source)
Called when a user gets a notice.
def irc_NICK(self, prefix, params): (source)
Called when a user changes their nickname.
def irc_KICK(self, prefix, params): (source)
Called when a user is kicked from a channel.
def irc_TOPIC(self, prefix, params): (source)
Someone in the channel set the topic.
def irc_RPL_TOPIC(self, prefix, params): (source)
Called when the topic for a channel is initially reported or when it subsequently changes.
def irc_RPL_NOTOPIC(self, prefix, params): (source)
Undocumented
def irc_RPL_MOTDSTART(self, prefix, params):