comparison plugins/HOWTO @ 94:9f6ce50ffb78

[gaim-migrate @ 104] Woohoo, the landing of the plugins. Nearly everything necessary is here. The only thing missing is that you can't load a plugin without signing on first (at least, not without some trickery). committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Sun, 09 Apr 2000 11:18:25 +0000
parents 5ca21b68eb29
children 19cffb5bd129
comparison
equal deleted inserted replaced
93:5ca21b68eb29 94:9f6ce50ffb78
1 Ok, this howto is going to be really short and sweet and to the point. 1 Ok, this howto is going to be really short and sweet and to the point.
2 2
3 First off, before you do anything else, in all of the files for your plugin, 3 First off, before you do anything else, in all of the files for your plugin,
4 put the lines 4 put the lines
5 5
6 #define GAIM_PLUGIN 6 #define GAIM_PLUGINS
7 #include "gaim.h" 7 #include "gaim.h"
8 8
9 I mean this. Without this, all kinds of things will not work correctly. If you 9 I mean this. Without this, all kinds of things will not work correctly. If you
10 really want to know exactly what this does, read ../src/gaim.h and learn. But 10 really want to know exactly what this does, read ../src/gaim.h and learn. But
11 if you don't want to do that, just know that it's important. 11 if you don't want to do that, just know that it's important.
12 12
13 Now that you've put that there, make sure gaim.h is in your include path. 13 Now that you've put that there, make sure gaim.h is in your include path.
14 14
15 Ok, now you're ready to write the plugin. 15 Ok, now you're ready to write the plugin.
16 16
17 The only function that is required is gaim_plugin_init(). This gets called as 17 The only function that is required is gaim_plugin_init(void *). This gets
18 soon as it gets loaded (sort of - man dlopen for more details). If your 18 called as soon as it gets loaded (sort of - man dlopen for more details). If
19 function never returns, it will crash gaim! If your plugin uses up all the 19 your function never returns, it will crash gaim! If your plugin uses up all
20 memory in the system, it will crash gaim! Once your plugin gets loaded, it 20 the memory in the system, it will crash gaim! Once your plugin gets loaded,
21 effectively becomes a part of gaim, and anything that goes wrong will look 21 it effectively becomes a part of gaim, and anything that goes wrong will look
22 like it is a problem with gaim itself. I write bugfree code! :) Therefore, it 22 like it is a problem with gaim itself. I write bugfree code! :) Therefore, it
23 is your problem, not mine. 23 is your problem, not mine. (I'm usually nice and willing to help you with your
24 problems though.)
25
26 The void * that gets passed to gaim_plugin_init is the handle for the plugin.
27 DO NOT CHANGE THIS POINTER! Bad things will happen. You've been warned. It's
28 needed for connecting to signals and things. It's a good idea to remember it
29 somehow.
24 30
25 You can basically do anything you want in the plugin. You can make function 31 You can basically do anything you want in the plugin. You can make function
26 calls, change public widgets, display new widgets, things like that. But the 32 calls, change public widgets, display new widgets, things like that. But the
27 really need thing is you can do things at events. For example, when one of 33 really need thing is you can do things at events. For example, when one of
28 your buddies signs on, you can instantly send them a message. You can modify 34 your buddies signs on, you can instantly send them a message. You can modify