Table of Contents

Name

::irc - Create IRC connection and interface.

Synopsis

package require Tcl

package require irc ?0.1?

::irc::connection hostname

Description

This package provides low-level commands to deal with the IRC protocol (Internet Relay Chat) for immediate and interactive multi-cast communication.

The ::irc::connection command creates a new object to deal with an IRC connection. Creating this IRC object does not automatically create the network connection. The ::irc::connection command returns a new irc namespace command which can be used to interact with the new IRC connection.

Per-connection Commands

In the following list of available connection methods net represents a connection command as returned by ::irc::connection.

net registerevent event script
Registers a callback handler for the specific event. Events available are those described in the IRC RFC: 1459. In addition, there are several other events defined. defaultcommand adds a command that is called if no other callback is present. EOF is called if the connection signals an End of File condition. script is executed in the connection namespace, which can take advantage of several commands (see Callback Commands below) to aid in the parsing of data.

net connect
This causes the socket to be established. ::irc::connection created the namespace and the commands to be used, but did not actually open the socket. This is done here.

net user username localhostname userinfo Sends USER command to server. username is the username you want to appear. localhost name is the name of your server, and userinfo is a short description of who you are.

net nick nick
NICK command. nick is the nickname you wish to use for the particular connection.

net ping
PING the IRC server.

net join channel
channel is the IRC channel to join. IRC channels typically begin with a #.

net part channel
Makes the client leave channel.

net privmsg target message
Sends message to target, which can be either a channel, or another user, in which case their nick is used. net send text Sends text to the IRC server.

Callback Commands

These commands are used within callbacks

who ?address?
Returns the nick of the user who performed a command. The optional address argument causes the command to return the username@address of the user.

action Returns the action perfomed, such as KICK, PRIVMSG, MODE, etc... Normally not useful, as callbacks are bound to a particular event.

target ?index?
Returns the target of a particular command, such as the channel or user to whom a PRIVMSG is sent. In the case of multiple targets, the optional index argument may be used to specify which one to return. The default is 0.

msg
Returns the message portion of the command (the part after the :).

Global Commands

::irc::config key value
Sets configuration key to value. Currently, the only config key defined is debug which, when turned on, makes ::irc print more information about what is going on.

See Also

rfc 1459

Keywords

irc, chat


Table of Contents