annotate doc/TCL-HOWTO.dox @ 12496:f9d0ab1474ac

[gaim-migrate @ 14808] removing meanwhile library code from gaim tree, use libmeanwhile-1.0.0 instead if available to enable the sametime plugin. also fixing a status message bug due to unescaped markup committer: Tailor Script <tailor@pidgin.im>
author Christopher O'Brien <siege@pidgin.im>
date Fri, 16 Dec 2005 04:08:05 +0000
parents 0e886a234d92
children 1414e0e01dc5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10409
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1 /** @page tcl-howto Tcl Scripting HOWTO
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
2
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
3 @section Intoduction
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
4
10597
0e886a234d92 [gaim-migrate @ 12012]
Ethan Blanton <elb@pidgin.im>
parents: 10410
diff changeset
5 NOTA BENE: This documentation is badly out of date for 2.x.
0e886a234d92 [gaim-migrate @ 12012]
Ethan Blanton <elb@pidgin.im>
parents: 10410
diff changeset
6
10409
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
7 The Gaim Tcl interface provides a Tcl API for many useful gaim
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
8 functions. Like the perl API, the Tcl API does not provide
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
9 access to every corner of gaim exposed by the @e C interface. It does,
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
10 however, provide a very powerful interface to many of Gaim's functions
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
11 through a simple to learn and extend scripting language.
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
12
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
13 If you are not familiar with Tcl, you will probably find it somewhat
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
14 different from what you are used to. Despite being somewhat unique
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
15 (more akin to shell programming than other traditional scripting
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
16 languages such as @e perl or @e python), it is simple to learn for
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
17 beginners and experienced programmers alike. There are numerous books
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
18 on the subject; we will not discuss it any further here.
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
19
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
20 @section start Getting Started
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
21
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
22 The only requirement placed on a Gaim Tcl script by Gaim is the
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
23 existence of a procedure called @c plugin_init. This procedure has
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
24 some limitations placed upon it; it will be parsed and evaluated before
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
25 the rest of the Tcl script, so it cannot reference any other variables
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
26 or procedures declared in the script. In practice this is not a
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
27 problem, as the only thing this procedure should do is return a simple
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
28 list containing five items: the @b name of the script, its @b version
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
29 number, a @b summary (just a few words) of its function, a short (longer
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
30 than the summary, but no more than a couple of sentences if possible)
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
31 @b description, the @b author, and a @b URL to web page. For example:
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
32
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
33 @code
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
34 proc plugin_init { } {
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
35 return [ list "Example Plugin" \
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
36 "1.0" \
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
37 "Example plugin registration" \
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
38 "Example of how to register a plugin for the Tcl HOWTO" \
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
39 "Ethan Blanton <eblanton@cs.purdue.edu>" \
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
40 "http://gaim.sf.net/" ]
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
41 }
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
42 @endcode
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
43
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
44 The rest of the script will generally be registration to recieve
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
45 notification of various Gaim signals (more about this below) and
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
46 definitions of procedures to be executed when those signals occur.
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
47
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
48 @section details Interpreter Details
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
49
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
50 Gaim initializes and drives the Tcl event loop (similar to Tk),
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
51 meaning that commands like @c fileevent and @c after are available and
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
52 do not require @c vwait etc. The @c vwait actually seems to be somewhat
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
53 broken due to a bug somewhere in the Tcl/Glib event loop glue, and it
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
54 should not be used for now.
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
55
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
56 The gaim-specific functions are provided in a statically-linked
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
57 package called @c gaim; this means that if you spawn a child
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
58 interpreter and wish to use the gaim-specific functions, you will need
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
59 to execute <tt>load {} gaim</tt> in that interpreter.
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
60
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
61 @section internals Gaim Internal Procedures and Variables
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
62
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
63 All of the information provided for your use by Gaim will be in the @c
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
64 ::gaim namespace. This means that in order to access it you will either
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
65 have to import the gaim namespace (e.g. via the command <tt>namespace
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
66 import gaim::*</tt>) or reference it explicitly. The following
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
67 descriptions will reference it explicitly for clarity.
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
68
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
69 @li Variables
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
70
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
71 @code
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
72 gaim::version
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
73 @endcode
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
74
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
75 This contains the version of the gaim process which loaded the
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
76 script.
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
77
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
78 @li Commands
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
79
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
80 @code
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
81 gaim::account alias account
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
82 gaim::account connect account
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
83 gaim::account connection account
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
84 gaim::account disconnect account
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
85 gaim::account find username protocol
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
86 gaim::account handle
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
87 gaim::account isconnected account
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
88 gaim::account list ?option?
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
89 gaim::account protocol account
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
90 gaim::account username account
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
91 @endcode
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
92
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
93 The @c gaim::account command consists of a set of subcommands
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
94 pertaining to gaim accounts.
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
95
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
96 @c alias returns the alias for the account @c account. If there is no
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
97 alias for the given account, it returns the empty string.
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
98
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
99 The subcommand @c connect connects the named account if it is not
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
100 connected, and does nothing if it is. In either case, it returns
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
101 the @c gc for the account.
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
102
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
103 @c connection returns the @c gc of the given account if it is connected,
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
104 or 0 if it is not. This @c gc is the gc used by gaim::connection and
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
105 other functions.
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
106
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
107 @c disconnect disconnects the given @c account if it is connected, or
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
108 does nothing if it is.
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
109
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
110 @c find finds an account by its @c username and @c protocol (as returned by
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
111 <tt>gaim::account username</tt> and <tt>gaim::account protocol</tt>) and
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
112 returns the account if found, or 0 otherwise.
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
113
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
114 @c handle returns the instance handle required to connect to account
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
115 signals. (See <tt>gaim::signal connect</tt>).
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
116
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
117 The @c isconnected query returns true if the given account is
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
118 connected and false otherwise.
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
119
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
120 The @c list subcommand returns a list of all of the accounts known to
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
121 Gaim. The elements of this lists are accounts appropriate for the
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
122 @c account argument of the other subcommands. The @c -all option
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
123 (default) returns all accounts, while the @c -online option returns
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
124 only those accounts which are online.
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
125
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
126 The @c protocol subcommand returns the protocol ID (e.g. "prpl-msn")
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
127 for the given account.
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
128
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
129 The @c username subcommand returns the username for the account
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
130 @c account.
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
131
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
132 @code
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
133 gaim::buddy alias buddy
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
134 gaim::buddy handle
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
135 gaim::buddy info ( buddy | account username )
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
136 gaim::buddy list
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
137 @endcode
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
138
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
139 @c gaim::buddy is a set of commands for retrieving information about
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
140 buddies and manipulating the buddy list. For the purposes of Tcl,
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
141 a "buddy" is currently a list of several elements, the first of
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
142 which being the type. The currently recognized types are "group",
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
143 "buddy", and "chat". A group node looks like:
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
144 @code
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
145 { group name { buddies } }
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
146 @endcode
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
147 A buddy node is:
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
148 @code
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
149 { buddy name account }
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
150 @endcode
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
151 And a chat node is:
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
152 @code
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
153 { chat alias account }
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
154 @endcode
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
155
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
156 The @c alias subcommand returns the alias for the given buddy if it
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
157 exists, or the empty string if it does not.
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
158
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
159 @c handle returns the blist handle for the purposes of connecting
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
160 signals to buddy list events. (See <tt>gaim::signal connect</tt>).
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
161
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
162 @c info causes gaim to display the info dialog for the given buddy.
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
163 Since it is possible to request user info for a buddy not in your
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
164 buddy list, you may also specify a buddy by his or her username and
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
165 the account through which you wish to retrieve info.
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
166
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
167 @c list returns a list of @c group structures, filled out with buddies
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
168 and chats as described above.
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
169
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
170 @code
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
171 gaim::connection account gc
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
172 gaim::connection displayname gc
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
173 gaim::connection handle
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
174 gaim::connection list
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
175 @endcode
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
176
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
177 @c gaim::connection is a collection of subcommands pertaining to
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
178 account connections.
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
179
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
180 @c account returns the Gaim account associated with @c gc. This
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
181 account is the same account used by @c gaim::account and other
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
182 commands.
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
183
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
184 @c displayname returns the display name (duh) of @c gc as reported by
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
185 <tt>gaim_connection_get_display_name(gc)</tt>.
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
186
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
187 @c handle returns the gaim connections instance handle. (See
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
188 <tt>gaim::signal connect</tt>).
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
189
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
190 @c list returns a list of all known connections. The elements of
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
191 this list are appropriate as @c gc arguments to the other
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
192 @c gaim::connection subcommands or other commands requiring a gc.
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
193
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
194 @code
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
195 gaim::conv_send account who text
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
196 @endcode
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
197
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
198 @c gaim::conv is simply a convenience wrapper for @c gaim::send_im and
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
199 <tt>gaim::conversation write</tt>. It sends the IM, determines the from
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
200 and to arguments for <tt>gaim::conversation write</tt>, and prints the text
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
201 sent to the conversation as one would expect. For the curious, you
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
202 may view the source for it by typing <tt>info body gaim::conv_send</tt> at
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
203 a Gaim Commander prompt.
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
204
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
205 Note that an error in either @c gaim::send_im or <tt>gaim::conversation
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
206 write</tt> will not be caught by this procedure, and will be propagated
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
207 to the caller.
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
208
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
209 @code
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
210 gaim::conversation find ?-account account? name
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
211 gaim::conversation handle
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
212 gaim::conversation list
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
213 gaim::conversation new ?-chat? ?-im? account name
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
214 gaim::conversation write conversation style from to text
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
215 @endcode
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
216
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
217 @c gaim::conversation provides an API for dealing with conversations.
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
218 Given that Gaim is an instant messenger program, you'll probably
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
219 spend a lot of time here.
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
220
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
221 The command @c find attempts to find an existing conversation with
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
222 username @c name. If the @c -account option is given, it refines its
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
223 search to include only conversations on that account.
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
224
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
225 @c handle returns the conversations instance handle for the purposes
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
226 of signal connection. (See <tt>gaim::signal connect</tt>).
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
227
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
228 @c list returns a list of all currently open conversations.
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
229
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
230 The @c new subcommand can be used to create a new conversation with
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
231 a specified user on a specified account if one does not exist, or
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
232 retrieve the existing conversation if it does. The @c -chat and
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
233 @c -im options specify whether the created conversation should be a
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
234 chat or a standard IM, respectively.
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
235
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
236 @c write is used to write to the specified conversation. The @c style
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
237 argument specifies how the text should be printed -- as text coming
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
238 from the gaim user (style @c send), being sent to the gaim user
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
239 (style @c recv), or as a system message (such as "so-and-so has
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
240 signed off", style @c system). From is the name to whom the text
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
241 should be attributed -- you probably want to check for aliases here,
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
242 lest you confuse the user. @c text is the text to print.
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
243
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
244 @code
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
245 gaim::core handle
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
246 gaim::core quit
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
247 @endcode
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
248
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
249 This command exposes functionality provided by the gaim core API.
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
250
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
251 <tt>gaim::core handle</tt> returns a handle to the gaim core for signal
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
252 connection. (See <tt>gaim::signal connect</tt>).
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
253
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
254 @c quit exits gaim cleanly, and should be used in preference to the
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
255 tcl @c exit command. (Note that @c exit has not been removed,
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
256 however.)
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
257
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
258 @code
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
259 gaim::debug level category message
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
260 @endcode
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
261
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
262 Equivalent to the C gaim_debug function, this command outputs
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
263 debugging information to the gaim debug window (or stdout if gaim is
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
264 invoked with -d|--debug). The valid levels are, in increasing level
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
265 of severity, @c -misc, @c -info, @c -warning, and, or @c -error. @c
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
266 category is a short (a few characters ... for instance, "tcl" or "tcl
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
267 plugin") "topic" type name for this message, and @c message is the text
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
268 of the message. In the style of Tcl @e puts (and differing from
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
269 @e gaim_debug), no trailing \\n is required. (However, embedded newlines
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
270 may be generated with \\n).
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
271
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
272 @code
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
273 gaim::notify ?type? title primary secondary
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
274 @endcode
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
275
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
276 Also a direct equivalent to a C function, gaim_notify, this command
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
277 causes gaim to present the provided notification information to the
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
278 user via some appropriate UI method. The @c type argument, if
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
279 present, must be one of @c -error, @c -warning, or @c -info. The following
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
280 three arguments' absolute meanings may vary with the Gaim UI being
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
281 used (presently only a Gtk2 UI is available), but @c title should
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
282 generally be the title of the window, and @c primary and @c secondary
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
283 text within that window; in the Gtk2 UI, @c primary is slightly
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
284 larger than @c secondary and displayed in a @b boldface font.
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
285
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
286 @code
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
287 gaim::send_im gc who text
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
288 @endcode
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
289
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
290 This sends an IM in the fashion of serv_send_im. @c gc is the GC of
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
291 the connection on which you wish to send (as returned by most event
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
292 handlers), @c who is the nick of the buddy to which you wish to send,
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
293 and @c text is the text of the message.
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
294
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
295 @code
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
296 gaim::signal connect instance signal args proc
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
297 gaim::signal disconnect instance signal
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
298 @endcode
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
299
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
300 @c gaim::signal is a set of subcommands for dealing with gaim signals
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
301 (known as "events" prior to gaim 0.68).
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
302
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
303 The @c connect subcommand registers the procedure @c proc as a handler
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
304 for the signal @c signal on the instance @c instance. @c instance
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
305 should be an instance handle as returned by one of the @c handle
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
306 commands from the various parts of gaim. @c args and @ proc are as in
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
307 the Tcl @e proc command; note that the number of arguments in @c args
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
308 must match the number of arguments emitted by the signal exactly,
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
309 although you need not use them all. The procedure @c proc may be
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
310 either a simple command or a procedure in curly brackets. Note that
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
311 only one procedure may be associated with each signal; an attempt to
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
312 connect a second procedure to the same signal will remove the
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
313 existing binding and replace it with the new procedure.
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
314 <tt>gaim::signal connect</tt> returns 0 on success and 1 on failure.
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
315
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
316 @c disconnect removes any existing signal handler for the named
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
317 signal and instance.
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
318
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
319 @code
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
320 gaim::unload
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
321 @endcode
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
322
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
323 This unloads the current plugin. Note that preferences will not be
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
324 updated (yet).
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
325
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
326 @section Signals
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
327
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
328 Check the signals documentation for the meaning of these signals; this is
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
329 intended to be a list only of their arguments. Signal callbacks will
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
330 be made in their own namespace, and arguments to those signal
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
331 callbacks will live in the namespace @c event underneath that
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
332 namespace. To briefly illustrate, the signal @c receiving-im-msg is
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
333 provided with three arguments; the account on which the IM was
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
334 received, the screen name of the user sending the IM, and the text of
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
335 the IM. These arguments live in the variables @c event::account,
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
336 @c event::sender, and @c event::buffer, respectively. Therefore a callback
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
337 which notifies the user of an incoming IM containing the word 'shizzle'
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
338 might look like this:
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
339
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
340 @code
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
341 gaim::signal connect [gaim::conversation handle] receiving-im-msg {
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
342 if {[ string match "*shizzle*" $event::buffer ]} {
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
343 gaim::notify -info "tcl plugin" "Fo' shizzle" \
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
344 "$event::sender is down with the shizzle"
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
345 }
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
346 }
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
347 @endcode
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
348
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
349 Note that for some signals (notably @c receiving-im-msg, @c sending-im-msg,
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
350 and their chat counterparts), changes to the event arguments will
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
351 change the message itself from Gaim's vantage. For those signals
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
352 whose return value is meaningful, returning a value from the Tcl event
10410
f7878475292c [gaim-migrate @ 11658]
Ethan Blanton <elb@pidgin.im>
parents: 10409
diff changeset
353 will return that value as it would in C.
10409
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
354
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
355 */
68d6065fc32f [gaim-migrate @ 11657]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
356
10410
f7878475292c [gaim-migrate @ 11658]
Ethan Blanton <elb@pidgin.im>
parents: 10409
diff changeset
357 // vim: syntax=c tw=72 et