annotate doc/TCL-HOWTO.dox @ 10481:bcfea6c3d5c9

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