Mercurial > pidgin
comparison plugins/ChangeLog @ 425:ae7c762775cd
[gaim-migrate @ 435]
More mods to how plugins work.
committer: Tailor Script <tailor@pidgin.im>
| author | Eric Warmenhoven <eric@warmenhoven.org> |
|---|---|
| date | Fri, 23 Jun 2000 04:15:51 +0000 |
| parents | 3d94cc1dc424 |
| children | e4c34ca88d9b |
comparison
equal
deleted
inserted
replaced
| 424:22700acd9b49 | 425:ae7c762775cd |
|---|---|
| 1 version 0.9.20: | 1 version 0.9.20: |
| 2 It's 3 am the night before finals, it's obviously a good time to hack | 2 It's 3 am the night before finals, it's obviously a good time to hack |
| 3 gaim. | 3 gaim. |
| 4 | |
| 5 This became quite long, and if you don't want to read it all, here's | |
| 6 the important stuff summed up: | |
| 7 - 9 new events (see SIGNALS file for more details) | |
| 8 - int gaim_plugin_init(void *) (no longer returns void, see error.c) | |
| 9 - void gaim_plugin_unload(void *) (to allow plugin to remove itself) | |
| 10 - can only load 1 instance of the same plugin | |
| 4 | 11 |
| 5 The first thing to note is that there are about 9 new events plugins | 12 The first thing to note is that there are about 9 new events plugins |
| 6 can attach to, most of them dealing with chat, since I know that was a | 13 can attach to, most of them dealing with chat, since I know that was a |
| 7 big thing that was missing. Please note that I was nice and decided to | 14 big thing that was missing. Please note that I was nice and decided to |
| 8 tack these extra events onto the end of the enum, which means that | 15 tack these extra events onto the end of the enum, which means that |
| 9 plugins do not have to be recompiled in order for them to still work. | 16 plugins do not have to be recompiled in order for them to still work. |
| 10 | 17 |
| 11 The big thing to note is that gaim_plugin_init no longer returns void, | 18 The big change is that gaim_plugin_init no longer returns void, but |
| 12 but int. If it returns 0+, gaim interprets this as there being no | 19 int. If it returns 0+, gaim interprets this as there being no error, |
| 13 error, and continues with loading as normal. (This should be backwards- | 20 and continues with loading as normal. (This should be backwards- |
| 14 compatible: returning 0/1 is the equivalent of returning void.) If it | 21 compatible: returning 0/1 is the equivalent of returning void.) If it |
| 15 returns a number less than 0, there was an error loading detected by | 22 returns a number less than 0, there was an error loading detected by |
| 16 the plugin. At that point, gaim will try to clean things up by removing | 23 the plugin. At that point, gaim will try to clean things up by removing |
| 17 any callbacks that have been added by the plugin. It will then try to | 24 any callbacks that have been added by the plugin. It will then try to |
| 18 call the plugin's gaim_plugin_error function, if there is one. The | 25 call the plugin's gaim_plugin_error function, if there is one. The |
| 19 function should take an int (the int returned by gaim_plugin_init) and | 26 function should take an int (the int returned by gaim_plugin_init) and |
| 20 return a char*. If the char* is not NULL, it is displayed by gaim as an | 27 return a char*. If the char* is not NULL, it is displayed by gaim as an |
| 21 error message. The plugin is then unloaded and closed and life goes | 28 error message. The plugin is then unloaded and closed and life goes |
| 22 back to normal. If any of that was confusing, it was confusing to me, | 29 back to normal. If any of that was confusing, it was confusing to me, |
| 23 too. I added a plugin, error.c, which should help clear things up. | 30 too. I added a plugin, error.c, which should help clear things up. |
| 31 | |
| 32 Another big thing to note is that plugins can unload themselves. A good | |
| 33 example of why this is useful is a ticker plugin. If the user closes | |
| 34 the ticker window, they obviously want the plugin to be unloaded. Gaim | |
| 35 has no way of knowing that; therefore, the plugin must tell gaim that | |
| 36 it is to be unloaded. To have a plugin unload itself, simply call | |
| 37 gaim_plugin_unload(void *) (the void* is the handle passed to | |
| 38 gaim_plugin_init). Because you are explicitly asking to be removed, | |
| 39 gaim assumes that you have done any cleanup already, and so does not | |
| 40 call gaim_plugin_remove. Rather, it simply removes your callbacks and | |
| 41 unloads the plugin. (There is some trickery to this. Think about it: | |
| 42 your plugin calls the function, your plugin is unloaded, and execution | |
| 43 returns to your plugin, which no longer exists. This would cause a | |
| 44 segfault if it behaved exactly as described. Instead, the plugin is | |
| 45 removed from the list of plugins, and removed 5 seconds later. By then | |
| 46 the plugin should be effectively gone, though still in memory.) | |
| 47 | |
| 48 In previous versions of gaim, you could load multiple copies of the | |
| 49 same plugin. This is no longer the case. The reason for this was that | |
| 50 there were not two instances of the plugin in memory; rather, one copy | |
| 51 and two structures representing the same plugin. Then, the callbacks | |
| 52 would be called twice (since the plugin would most likely act the same | |
| 53 across multiple instances), and when one was unloaded, all callbacks | |
| 54 for both instances would be removed. Rather than deal with two copies | |
| 55 of the same plugin, it is easier and cleaner to only handle one. | |
| 24 | 56 |
| 25 There is a new event, event_quit, which signifies that gaim has exited | 57 There is a new event, event_quit, which signifies that gaim has exited |
| 26 correctly (i.e. didn't segfault). Also, after this event is called, all | 58 correctly (i.e. didn't segfault). Also, after this event is called, all |
| 27 plugins are removed, and their gaim_plugin_remove function is called. | 59 plugins are removed, and their gaim_plugin_remove function is called. |
| 28 This behavior is different from previous versions; however, it is the | 60 This behavior is different from previous versions; however, it is the |
