doc/TCL-HOWTO.dox

Sun, 09 Nov 2008 16:42:04 +0000

author
Ethan Blanton <elb@pidgin.im>
date
Sun, 09 Nov 2008 16:42:04 +0000
changeset 24595
8b5abc3f53a9
parent 16257
66f737e6b718
child 25889
26d9ca30335c
permissions
-rw-r--r--

Update the TCL-HOWTO to some more modern nomenclature

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

mercurial