1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240
|
[vset VERSION 0.6.2]
[comment {-*- tcl -*- doctools manpage}]
[manpage_begin irc n [vset VERSION]]
[see_also {rfc 1459}]
[keywords chat]
[keywords irc]
[moddesc {Low Level Tcl IRC Interface}]
[titledesc {Create IRC connection and interface.}]
[category Networking]
[require Tcl]
[require irc [opt [vset VERSION]]]
[description]
This package provides low-level commands to deal with the IRC protocol
(Internet Relay Chat) for immediate and interactive multi-cast
communication.
[para]
[list_begin definitions]
[call [cmd ::irc::config] [opt key] [opt value]]
Sets configuration [opt key] to [opt value]. The configuration keys
currently defined are the boolean flags [const logger] and [const debug].
[const logger] makes [package irc] use the logger package for printing
error. [const debug] requires [const logger] and prints extra debug output.
If no [opt key] or [opt value] is given the current values are returned.
[call [cmd ::irc::connection]]
The command creates a new object to deal with an IRC connection.
Creating this IRC object does not automatically create the network
connection. It returns a new irc namespace command which can be used
to interact with the new IRC connection. NOTE: the old form of the
connection command, which took a hostname and port as arguments, is
deprecated. Use [cmd connect] instead to specify this information.
[call [cmd ::irc::connections]]
Returns a list of all the current connections that were created with
[const connection]
[list_end]
[section {Per-connection Commands}]
[para]
In the following list of available connection methods [arg net]
represents a connection command as returned by
[cmd ::irc::connection].
[list_begin definitions]
[call [arg net] [method registerevent] [arg event] [arg script]]
Registers a callback handler for the specific event. Events available
are those described in RFC 1459
[uri http://www.rfc-editor.org/rfc/rfc1459.txt].
In addition, there are several other events defined.
[const defaultcmd] adds a command that is called if no other callback
is present. [const EOF] is called if the connection signals an End of
File condition. The events [const defaultcmd], [const defaultnumeric],
[const defaultevent], and [const EOF] are required.
[arg script] is executed in the connection namespace, which can take
advantage of several commands (see [sectref {Callback Commands}]
below) to aid in the parsing of data.
[call [arg net] [method getevent] [arg event] [arg script]]
Returns the current handler for the event if one exists. Otherwise an
empty string is returned.
[call [arg net] [method eventexists] [arg event] [arg script]]
Returns a boolean value indicating the existence of the event handler.
[call [arg net] [method connect] [arg hostname] [opt port]]
This causes the socket to be established. [cmd ::irc::connection]
created the namespace and the commands to be used, but did not
actually open the socket. This is done here. NOTE: the older form of
'connect' did not require the user to specify a hostname and port,
which were specified with 'connection'. That form is deprecated.
[call [arg net] [method config] [opt key] [opt value]]
The same as [cmd ::irc::config] but sets and gets options for the [arg net]
connection only.
[call [arg net] [method log] [arg level] [arg message]]
If logger is turned on by [method config] this will write a log [arg message]
at [arg level].
[call [arg net] [method logname]]
Returns the name of the logger instance if logger is turned on.
[call [arg net] [method connected]]
Returns a boolean value indicating if this connection is connected to a server.
[call [arg net] [method sockname]]
Returns a 3 element list consisting of the ip address, the hostname, and the port
of the local end of the connection, if currently connected.
[call [arg net] [method peername]]
Returns a 3 element list consisting of the ip address, the hostname, and the port
of the remote end of the connection, if currently connected.
[call [arg net] [method socket]]
Return the Tcl channel for the socket used by the connection.
[call [arg net] [method user] [arg username] [arg localhostname] [arg localdomainname] [arg userinfo]]
Sends USER command to server. [arg username] is the username you want
to appear. [arg localhostname] is the host portion of your hostname, [arg localdomainname]
is your domain name, and [arg userinfo] is a short description of who you are. The 2nd and 3rd
arguments are normally ignored by the IRC server.
[call [arg net] [method nick] [arg nick]]
NICK command. [arg nick] is the nickname you wish to use for the
particular connection.
[call [arg net] [method ping] [arg target]]
Send a CTCP PING to [arg target].
[call [arg net] [method serverping]]
PING the server.
[call [arg net] [method join] [arg channel] [opt [arg key]]]
[arg channel] is the IRC channel to join. IRC channels typically
begin with a hashmark ("#") or ampersand ("&").
[call [arg net] [method part] [arg channel] [opt [arg message]]]
Makes the client leave [arg channel]. Some networks may support the optional
argument [arg message]
[call [arg net] [method quit] [opt [arg message]]]
Instructs the IRC server to close the current connection. The package
will use a generic default if no [arg message] was specified.
[call [arg net] [method privmsg] [arg target] [arg message]]
Sends [arg message] to [arg target], which can be either a channel, or
another user, in which case their nick is used.
[call [arg net] [method notice] [arg target] [arg message]]
Sends a [const notice] with message [arg message] to [arg target],
which can be either a channel, or another user, in which case their nick is used.
[call [arg net] [method ctcp] [arg target] [arg message]]
Sends a CTCP of type [arg message] to [arg target]
[call [arg net] [method kick] [arg channel] [arg target] [opt [arg message]]]
Kicks the user [arg target] from the channel [arg channel] with a [arg message].
The latter can be left out.
[call [arg net] [method mode] [arg target] [arg args]]
Sets the mode [arg args] on the target [arg target]. [arg target] may be a channel,
a channel user, or yourself.
[call [arg net] [method topic] [arg channel] [arg message]]
Sets the topic on [arg channel] to [arg message] specifying an empty string
will remove the topic.
[call [arg net] [method invite] [arg channel] [arg target]]
Invites [arg target] to join the channel [arg channel]
[call [arg net] [method send] [arg text]]
Sends [arg text] to the IRC server.
[call [arg net] [method destroy]]
Deletes the connection and its associated namespace and information.
[list_end]
[section {Callback Commands}]
[para]
These commands can be used within callbacks
[list_begin definitions]
[call [cmd who] [opt [const address]]]
Returns the nick of the user who performed a command. The optional
keyword [const address] causes the command to return the user in the
format "username@address".
[call [cmd action]]
Returns the action performed, such as KICK, PRIVMSG, MODE, etc...
Normally not useful, as callbacks are bound to a particular event.
[call [cmd target]]
Returns the target of a particular command, such as the channel or
user to whom a PRIVMSG is sent.
[call [cmd additional]]
Returns a list of any additional arguments after the target.
[call [cmd header]]
Returns the entire event header (everything up to the :) as a proper list.
[call [cmd msg]]
Returns the message portion of the command (the part after the :).
[list_end]
[vset CATEGORY irc]
[include ../common-text/feedback.inc]
[manpage_end]
|