comparison plugins/PERL-HOWTO @ 785:dc9ad68fc30e

[gaim-migrate @ 795] more perl stuff committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Tue, 29 Aug 2000 05:25:13 +0000
parents c4c4a18bb2f9
children 1afe98d2461e
comparison
equal deleted inserted replaced
784:4c292b3f74ea 785:dc9ad68fc30e
15 when something takes quite a bit of trickery not offered by perl. But for 15 when something takes quite a bit of trickery not offered by perl. But for
16 the most part things should be written in Perl. It's more stable than 16 the most part things should be written in Perl. It's more stable than
17 plugins. 17 plugins.
18 18
19 Right now, the only way to test that your script is working correctly is to 19 Right now, the only way to test that your script is working correctly is to
20 load the perl plugin and load the script through that. Though, right now 20 load the perl plugin and load the script through that. (This is also the only
21 there really isn't much point in writing a script, since the two major 21 way I have of knowing that the interface is working correctly.)
22 functions in the AIM module (message_handler and command_handler) haven't
23 been implemented yet.
24 22
25 Everything available in normal perl scripts should be available in gaim's 23 Everything available in normal perl scripts should be available in gaim's
26 perl interface, so I'm not going to bother describing that. The important 24 perl interface, so I'm not going to bother describing that. The important
27 things are the functions provided by gaim's internal AIM module, which is 25 things are the functions provided by gaim's internal AIM module, which is
28 what most of this document is about. So, onto the functions. 26 what most of this document is about. So, onto the functions.
95 shouldn't be using a computer. 93 shouldn't be using a computer.
96 94
97 AIM::print_to_chat(room, what) 95 AIM::print_to_chat(room, what)
98 This should be just as obvious as the last command. 96 This should be just as obvious as the last command.
99 97
100 AIM::add_message_handler 98 AIM::add_event_handler(event, function)
101 This actually hasn't been implemented yet, so don't worry about it 99 This is the most important of them all. This is basically exactly like
100 gaim_signal_connect. You pass which event you want to connect to (a string
101 with the same name as the events for plugins, see SIGNALS), and a string
102 with the name of the function you want called. Simple enough?
102 103
103 AIM::add_command_handler 104 When this is triggered, the same arguments will be passed in @_ and are not
104 This hasn't been implemented yet either. Pay no attention. 105 broken into a list, but left as one long string. You'll have to parse those
106 yourself with split. (Sounding exactly like X-Chat yet?) The arguments are
107 the exact same as those passed to the plugins, and are passed after the
108 plugins have had their way with them. Perl scripts cannot modify the values
109 so that gaim knows what the changes are. Unlike X-Chat, perl scripts cannot
110 short-circut gaim (that is, your script will be called in order it was added,
111 despite what other scripts do, and afterwards, execution will continue as
112 normal).
105 113
106 AIM::add_timeout_handler(integer, function) 114 AIM::add_timeout_handler(integer, function)
107 This calls function after integer number of seconds. It only calls function 115 This calls function after integer number of seconds. It only calls function
108 once, so if you want to keep calling function, keep reading the handler. 116 once, so if you want to keep calling function, keep reading the handler.