Mercurial > pidgin
comparison plugins/PERL-HOWTO @ 802:1afe98d2461e
[gaim-migrate @ 812]
ha, i'm smart. i should commit to things.
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Wed, 30 Aug 2000 23:27:04 +0000 |
parents | dc9ad68fc30e |
children | 67bdecdecbb7 |
comparison
equal
deleted
inserted
replaced
801:1a47432e2ba1 | 802:1afe98d2461e |
---|---|
13 Plugins are more powerful as they can directly access gaim's functions and | 13 Plugins are more powerful as they can directly access gaim's functions and |
14 variables; as such they should be used for things like modifying the UI or | 14 variables; as such they should be used for things like modifying the UI or |
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 | |
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. (This is also the only | |
21 way I have of knowing that the interface is working correctly.) | |
22 | 18 |
23 Everything available in normal perl scripts should be available in gaim's | 19 Everything available in normal perl scripts should be available in gaim's |
24 perl interface, so I'm not going to bother describing that. The important | 20 perl interface, so I'm not going to bother describing that. The important |
25 things are the functions provided by gaim's internal AIM module, which is | 21 things are the functions provided by gaim's internal AIM module, which is |
26 what most of this document is about. So, onto the functions. | 22 what most of this document is about. So, onto the functions. |
93 shouldn't be using a computer. | 89 shouldn't be using a computer. |
94 | 90 |
95 AIM::print_to_chat(room, what) | 91 AIM::print_to_chat(room, what) |
96 This should be just as obvious as the last command. | 92 This should be just as obvious as the last command. |
97 | 93 |
94 | |
98 AIM::add_event_handler(event, function) | 95 AIM::add_event_handler(event, function) |
99 This is the most important of them all. This is basically exactly like | 96 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 | 97 gaim_signal_connect for plugins. You pass which event you want to connect to |
101 with the same name as the events for plugins, see SIGNALS), and a string | 98 (a string with the same name as the events for plugins, see SIGNALS), and a |
102 with the name of the function you want called. Simple enough? | 99 string with the name of the function you want called. Simple enough? |
103 | 100 |
104 When this is triggered, the same arguments will be passed in @_ and are not | 101 When this is triggered, the arguments will be passed in @_ and are not |
105 broken into a list, but left as one long string. You'll have to parse those | 102 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 | 103 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 | 104 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 | 105 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 | 106 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, | 107 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 | 108 despite what other scripts do, and afterwards, execution will continue as |
112 normal). | 109 normal). Names of buddies and chat rooms will be in quotes, and all other |
110 values (like text messages) will not be. | |
113 | 111 |
114 AIM::add_timeout_handler(integer, function) | 112 AIM::add_timeout_handler(integer, function) |
115 This calls function after integer number of seconds. It only calls function | 113 This calls function after integer number of seconds. It only calls function |
116 once, so if you want to keep calling function, keep reading the handler. | 114 once, so if you want to keep calling function, keep reading the handler. |