comparison plugins/PERL-HOWTO @ 3563:e120097bbd72

[gaim-migrate @ 3658] I made my perl script unloading not suck (as much). Now you may port your perl scripts--use gaim.pl and PERL-HOWTO as references. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Sat, 28 Sep 2002 08:08:14 +0000
parents cd938f18f3f8
children 283fb289c510
comparison
equal deleted inserted replaced
3562:de3bc24fff02 3563:e120097bbd72
40 40
41 GAIM::register(name, version, shutdownroutine, unused) 41 GAIM::register(name, version, shutdownroutine, unused)
42 Just like X-Chat. This is the first function your script should call. 42 Just like X-Chat. This is the first function your script should call.
43 shutdownroutine is a function that will be called when the script 43 shutdownroutine is a function that will be called when the script
44 gets unloaded (like when gaim gets closed). This function returns 44 gets unloaded (like when gaim gets closed). This function returns
45 gaim's version number. 45 gaim's version number. This function MUST use the same Name and Version
46 given in description()--the plugin won't work otherwise. This returns a
47 handle--you want to hold on to this.
48
49 The handle is what Gaim will use to distinguish your script from any others
50 running. It's actually a string--the path to the script, but you'll probably
51 never need to know that. As long as you just hold on to it and don't change it
52 everything should work fine. You need it for GAIM::add_event_handler and
53 GAIM::add_timeout_handler.
46 54
47 GAIM::get_info(integer, ...) 55 GAIM::get_info(integer, ...)
48 This function returns different information based on the integer passed 56 This function returns different information based on the integer passed
49 to it. 57 to it.
50 0 - the version of gaim you're running ("0.10.0" for example). 58 0 - the version of gaim you're running ("0.10.0" for example).
123 Convenience function; combination of write_to_conv and serv_send_im. 131 Convenience function; combination of write_to_conv and serv_send_im.
124 132
125 GAIM::print_to_chat(index, room, what) 133 GAIM::print_to_chat(index, room, what)
126 Room is actually an int. Read SIGNALS to find out why. 134 Room is actually an int. Read SIGNALS to find out why.
127 135
128 GAIM::add_event_handler(event, function) 136 GAIM::add_event_handler(handle, event, function)
129 This is the most important of them all. This is basically exactly like 137 This is the most important of them all. This is basically exactly like
130 gaim_signal_connect for plugins. You pass which event you want to connect to 138 gaim_signal_connect for plugins. You pass the handle returned by GAIM::register,
131 (a string with the same name as the events for plugins, see SIGNALS), and a 139 which event you want to connect to (a string with the same name as the events for
132 string with the name of the function you want called. Simple enough? 140 plugins, see SIGNALS), and a string with the name of the function you want called.
141 Simple enough?
133 142
134 When this is triggered, the arguments will be passed in @_ and are broken 143 When this is triggered, the arguments will be passed in @_ and are broken
135 into a list. This is different from all previous versions of Gaim, where you 144 into a list. This is different from all previous versions of Gaim, where you
136 had to parse the arguments yourself. The arguments are quite different from 145 had to parse the arguments yourself. The arguments are quite different from
137 what's passed to the plugins, though they are very similar, and you should 146 what's passed to the plugins, though they are very similar, and you should
148 GAIM::remove_event_handler(event, function) 157 GAIM::remove_event_handler(event, function)
149 This removes the event handler for the specified event that 158 This removes the event handler for the specified event that
150 calls "function" as its handler. The event handler must have been 159 calls "function" as its handler. The event handler must have been
151 previously added with GAIM::add_event_handler. 160 previously added with GAIM::add_event_handler.
152 161
153 GAIM::add_timeout_handler(integer, function, args) 162 GAIM::add_timeout_handler(handle, integer, function, args)
154 This calls function after integer number of seconds. It only calls function 163 This calls function after integer number of seconds. It only calls function
155 once, so if you want to keep calling function, keep readding the handler. 164 once, so if you want to keep calling function, keep readding the handler.
156 Args is a string that you'd like to have passed to your timeout handler; it's 165 Args is a string that you'd like to have passed to your timeout handler; it's
157 optional. 166 optional. Handle is the handle returned by GAIM::register--it is not optional.
158 167
159 GAIM::play_sound(int sound) 168 GAIM::play_sound(int sound)
160 Plays a sound using whatever method the user has selected. The argument is 169 Plays a sound using whatever method the user has selected. The argument is
161 one of the following numbers: 170 one of the following numbers:
162 171