1irc(n) Low Level Tcl IRC Interface irc(n)
2
3
4
5______________________________________________________________________________
6
8 irc - Create IRC connection and interface.
9
11 package require Tcl
12
13 package require irc ?0.6.2?
14
15 ::irc::config ?key? ?value?
16
17 ::irc::connection
18
19 ::irc::connections
20
21 net registerevent event script
22
23 net getevent event script
24
25 net eventexists event script
26
27 net connect hostname ?port?
28
29 net config ?key? ?value?
30
31 net log level message
32
33 net logname
34
35 net connected
36
37 net sockname
38
39 net peername
40
41 net socket
42
43 net user username localhostname localdomainname userinfo
44
45 net nick nick
46
47 net ping target
48
49 net serverping
50
51 net join channel ?key?
52
53 net part channel ?message?
54
55 net quit ?message?
56
57 net privmsg target message
58
59 net notice target message
60
61 net ctcp target message
62
63 net kick channel target ?message?
64
65 net mode target args
66
67 net topic channel message
68
69 net invite channel target
70
71 net send text
72
73 net destroy
74
75 who ?address?
76
77 action
78
79 target
80
81 additional
82
83 header
84
85 msg
86
87______________________________________________________________________________
88
90 This package provides low-level commands to deal with the IRC protocol
91 (Internet Relay Chat) for immediate and interactive multi-cast communi‐
92 cation.
93
94 ::irc::config ?key? ?value?
95 Sets configuration ?key? to ?value?. The configuration keys cur‐
96 rently defined are the boolean flags logger and debug. logger
97 makes irc use the logger package for printing error. debug
98 requires logger and prints extra debug output. If no ?key? or
99 ?value? is given the current values are returned.
100
101 ::irc::connection
102 The command creates a new object to deal with an IRC connection.
103 Creating this IRC object does not automatically create the net‐
104 work connection. It returns a new irc namespace command which
105 can be used to interact with the new IRC connection. NOTE: the
106 old form of the connection command, which took a hostname and
107 port as arguments, is deprecated. Use connect instead to spec‐
108 ify this information.
109
110 ::irc::connections
111 Returns a list of all the current connections that were created
112 with connection
113
115 In the following list of available connection methods net represents a
116 connection command as returned by ::irc::connection.
117
118 net registerevent event script
119 Registers a callback handler for the specific event. Events
120 available are those described in RFC 1459 http://www.rfc-edi‐
121 tor.org/rfc/rfc1459.txt. In addition, there are several other
122 events defined. defaultcmd adds a command that is called if no
123 other callback is present. EOF is called if the connection sig‐
124 nals an End of File condition. The events defaultcmd, defaultnu‐
125 meric, defaultevent, and EOF are required. script is executed
126 in the connection namespace, which can take advantage of several
127 commands (see Callback Commands below) to aid in the parsing of
128 data.
129
130 net getevent event script
131 Returns the current handler for the event if one exists. Other‐
132 wise an empty string is returned.
133
134 net eventexists event script
135 Returns a boolean value indicating the existence of the event
136 handler.
137
138 net connect hostname ?port?
139 This causes the socket to be established. ::irc::connection
140 created the namespace and the commands to be used, but did not
141 actually open the socket. This is done here. NOTE: the older
142 form of ´connect' did not require the user to specify a hostname
143 and port, which were specified with 'connection'. That form is
144 deprecated.
145
146 net config ?key? ?value?
147 The same as ::irc::config but sets and gets options for the net
148 connection only.
149
150 net log level message
151 If logger is turned on by config this will write a log message
152 at level.
153
154 net logname
155 Returns the name of the logger instance if logger is turned on.
156
157 net connected
158 Returns a boolean value indicating if this connection is con‐
159 nected to a server.
160
161 net sockname
162 Returns a 3 element list consisting of the ip address, the host‐
163 name, and the port of the local end of the connection, if cur‐
164 rently connected.
165
166 net peername
167 Returns a 3 element list consisting of the ip address, the host‐
168 name, and the port of the remote end of the connection, if cur‐
169 rently connected.
170
171 net socket
172 Return the Tcl channel for the socket used by the connection.
173
174 net user username localhostname localdomainname userinfo
175 Sends USER command to server. username is the username you want
176 to appear. localhostname is the host portion of your hostname,
177 localdomainname is your domain name, and userinfo is a short
178 description of who you are. The 2nd and 3rd arguments are nor‐
179 mally ignored by the IRC server.
180
181 net nick nick
182 NICK command. nick is the nickname you wish to use for the par‐
183 ticular connection.
184
185 net ping target
186 Send a CTCP PING to target.
187
188 net serverping
189 PING the server.
190
191 net join channel ?key?
192 channel is the IRC channel to join. IRC channels typically
193 begin with a hashmark ("#") or ampersand ("&").
194
195 net part channel ?message?
196 Makes the client leave channel. Some networks may support the
197 optional argument message
198
199 net quit ?message?
200 Instructs the IRC server to close the current connection. The
201 package will use a generic default if no message was specified.
202
203 net privmsg target message
204 Sends message to target, which can be either a channel, or
205 another user, in which case their nick is used.
206
207 net notice target message
208 Sends a notice with message message to target, which can be
209 either a channel, or another user, in which case their nick is
210 used.
211
212 net ctcp target message
213 Sends a CTCP of type message to target
214
215 net kick channel target ?message?
216 Kicks the user target from the channel channel with a message.
217 The latter can be left out.
218
219 net mode target args
220 Sets the mode args on the target target. target may be a chan‐
221 nel, a channel user, or yourself.
222
223 net topic channel message
224 Sets the topic on channel to message specifying an empty string
225 will remove the topic.
226
227 net invite channel target
228 Invites target to join the channel channel
229
230 net send text
231 Sends text to the IRC server.
232
233 net destroy
234 Deletes the connection and its associated namespace and informa‐
235 tion.
236
238 These commands can be used within callbacks
239
240 who ?address?
241 Returns the nick of the user who performed a command. The
242 optional keyword address causes the command to return the user
243 in the format "username@address".
244
245 action Returns the action performed, such as KICK, PRIVMSG, MODE,
246 etc... Normally not useful, as callbacks are bound to a partic‐
247 ular event.
248
249 target Returns the target of a particular command, such as the channel
250 or user to whom a PRIVMSG is sent.
251
252 additional
253 Returns a list of any additional arguments after the target.
254
255 header Returns the entire event header (everything up to the :) as a
256 proper list.
257
258 msg Returns the message portion of the command (the part after the
259 :).
260
262 This document, and the package it describes, will undoubtedly contain
263 bugs and other problems. Please report such in the category irc of the
264 Tcllib Trackers [http://core.tcl.tk/tcllib/reportlist]. Please also
265 report any ideas for enhancements you may have for either package
266 and/or documentation.
267
268 When proposing code changes, please provide unified diffs, i.e the out‐
269 put of diff -u.
270
271 Note further that attachments are strongly preferred over inlined
272 patches. Attachments can be made by going to the Edit form of the
273 ticket immediately after its creation, and then using the left-most
274 button in the secondary navigation bar.
275
277 rfc 1459
278
280 chat, irc
281
283 Networking
284
285
286
287tcllib 0.6.2 irc(n)