Mercurial > pidgin
comparison plugins/HOWTO @ 93:5ca21b68eb29
[gaim-migrate @ 103]
Notes on how to do plugins with gaim (note that this hasn't been
implemented completely yet, this is just how it *should* work).
committer: Tailor Script <tailor@pidgin.im>
| author | Eric Warmenhoven <eric@warmenhoven.org> |
|---|---|
| date | Sun, 09 Apr 2000 08:25:15 +0000 |
| parents | |
| children | 9f6ce50ffb78 |
comparison
equal
deleted
inserted
replaced
| 92:f3c6cf79f651 | 93:5ca21b68eb29 |
|---|---|
| 1 Ok, this howto is going to be really short and sweet and to the point. | |
| 2 | |
| 3 First off, before you do anything else, in all of the files for your plugin, | |
| 4 put the lines | |
| 5 | |
| 6 #define GAIM_PLUGIN | |
| 7 #include "gaim.h" | |
| 8 | |
| 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 | |
| 11 if you don't want to do that, just know that it's important. | |
| 12 | |
| 13 Now that you've put that there, make sure gaim.h is in your include path. | |
| 14 | |
| 15 Ok, now you're ready to write the plugin. | |
| 16 | |
| 17 The only function that is required is gaim_plugin_init(). This gets called as | |
| 18 soon as it gets loaded (sort of - man dlopen for more details). If your | |
| 19 function never returns, it will crash gaim! If your plugin uses up all the | |
| 20 memory in the system, it will crash gaim! Once your plugin gets loaded, it | |
| 21 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 | |
| 23 is your problem, not mine. | |
| 24 | |
| 25 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 | |
| 27 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 | |
| 29 the incoming and outgoing text. You can do all kinds of crazy things. Whatever | |
| 30 you want. Check out SIGNALS and CRAZY for more information and ideas. | |
| 31 | |
| 32 Plugins can share globals with gaim, but will not share with other plugins. | |
| 33 This is so if you have a global variable GtkWidget *window in your plugin and | |
| 34 J. Random Hacker also has the same name on a global variable, you won't be | |
| 35 constantly overwriting each others' variables. Unfortunately, this also means | |
| 36 that plugins will have difficulty working together. But then again, that's | |
| 37 what shared memory is for. | |
| 38 | |
| 39 When your plugin gets unloaded, gaim will try to call gaim_plugin_remove(). It | |
| 40 doesn't have to be there, but it's nice if, say, you create a window, and when | |
| 41 the plugin gets unloaded, it removes the window. | |
| 42 | |
| 43 There are a few examples in this directory. Enjoy. |
