Mercurial > pidgin
annotate 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 |
| rev | line source |
|---|---|
| 391 | 1 version 0.9.20: |
| 2 It's 3 am the night before finals, it's obviously a good time to hack | |
| 3 gaim. | |
| 4 | |
|
425
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
404
diff
changeset
|
5 This became quite long, and if you don't want to read it all, here's |
|
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
404
diff
changeset
|
6 the important stuff summed up: |
|
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
404
diff
changeset
|
7 - 9 new events (see SIGNALS file for more details) |
|
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
404
diff
changeset
|
8 - int gaim_plugin_init(void *) (no longer returns void, see error.c) |
|
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
404
diff
changeset
|
9 - void gaim_plugin_unload(void *) (to allow plugin to remove itself) |
|
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
404
diff
changeset
|
10 - can only load 1 instance of the same plugin |
|
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
404
diff
changeset
|
11 |
| 391 | 12 The first thing to note is that there are about 9 new events plugins |
| 13 can attach to, most of them dealing with chat, since I know that was a | |
| 14 big thing that was missing. Please note that I was nice and decided to | |
| 15 tack these extra events onto the end of the enum, which means that | |
| 16 plugins do not have to be recompiled in order for them to still work. | |
| 17 | |
|
425
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
404
diff
changeset
|
18 The big change is that gaim_plugin_init no longer returns void, but |
|
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
404
diff
changeset
|
19 int. If it returns 0+, gaim interprets this as there being no error, |
|
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
404
diff
changeset
|
20 and continues with loading as normal. (This should be backwards- |
|
398
59d97cd251ff
[gaim-migrate @ 408]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
394
diff
changeset
|
21 compatible: returning 0/1 is the equivalent of returning void.) If it |
|
59d97cd251ff
[gaim-migrate @ 408]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
394
diff
changeset
|
22 returns a number less than 0, there was an error loading detected by |
|
394
f73dc7d32ede
[gaim-migrate @ 404]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
392
diff
changeset
|
23 the plugin. At that point, gaim will try to clean things up by removing |
|
f73dc7d32ede
[gaim-migrate @ 404]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
392
diff
changeset
|
24 any callbacks that have been added by the plugin. It will then try to |
|
f73dc7d32ede
[gaim-migrate @ 404]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
392
diff
changeset
|
25 call the plugin's gaim_plugin_error function, if there is one. The |
|
f73dc7d32ede
[gaim-migrate @ 404]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
392
diff
changeset
|
26 function should take an int (the int returned by gaim_plugin_init) and |
|
f73dc7d32ede
[gaim-migrate @ 404]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
392
diff
changeset
|
27 return a char*. If the char* is not NULL, it is displayed by gaim as an |
|
f73dc7d32ede
[gaim-migrate @ 404]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
392
diff
changeset
|
28 error message. The plugin is then unloaded and closed and life goes |
|
f73dc7d32ede
[gaim-migrate @ 404]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
392
diff
changeset
|
29 back to normal. If any of that was confusing, it was confusing to me, |
|
f73dc7d32ede
[gaim-migrate @ 404]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
392
diff
changeset
|
30 too. I added a plugin, error.c, which should help clear things up. |
|
392
df5127560034
[gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
391
diff
changeset
|
31 |
|
425
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
404
diff
changeset
|
32 Another big thing to note is that plugins can unload themselves. A good |
|
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
404
diff
changeset
|
33 example of why this is useful is a ticker plugin. If the user closes |
|
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
404
diff
changeset
|
34 the ticker window, they obviously want the plugin to be unloaded. Gaim |
|
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
404
diff
changeset
|
35 has no way of knowing that; therefore, the plugin must tell gaim that |
|
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
404
diff
changeset
|
36 it is to be unloaded. To have a plugin unload itself, simply call |
|
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
404
diff
changeset
|
37 gaim_plugin_unload(void *) (the void* is the handle passed to |
|
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
404
diff
changeset
|
38 gaim_plugin_init). Because you are explicitly asking to be removed, |
|
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
404
diff
changeset
|
39 gaim assumes that you have done any cleanup already, and so does not |
|
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
404
diff
changeset
|
40 call gaim_plugin_remove. Rather, it simply removes your callbacks and |
|
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
404
diff
changeset
|
41 unloads the plugin. (There is some trickery to this. Think about it: |
|
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
404
diff
changeset
|
42 your plugin calls the function, your plugin is unloaded, and execution |
|
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
404
diff
changeset
|
43 returns to your plugin, which no longer exists. This would cause a |
|
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
404
diff
changeset
|
44 segfault if it behaved exactly as described. Instead, the plugin is |
|
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
404
diff
changeset
|
45 removed from the list of plugins, and removed 5 seconds later. By then |
|
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
404
diff
changeset
|
46 the plugin should be effectively gone, though still in memory.) |
|
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
404
diff
changeset
|
47 |
|
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
404
diff
changeset
|
48 In previous versions of gaim, you could load multiple copies of the |
|
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
404
diff
changeset
|
49 same plugin. This is no longer the case. The reason for this was that |
|
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
404
diff
changeset
|
50 there were not two instances of the plugin in memory; rather, one copy |
|
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
404
diff
changeset
|
51 and two structures representing the same plugin. Then, the callbacks |
|
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
404
diff
changeset
|
52 would be called twice (since the plugin would most likely act the same |
|
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
404
diff
changeset
|
53 across multiple instances), and when one was unloaded, all callbacks |
|
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
404
diff
changeset
|
54 for both instances would be removed. Rather than deal with two copies |
|
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
404
diff
changeset
|
55 of the same plugin, it is easier and cleaner to only handle one. |
|
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
404
diff
changeset
|
56 |
|
392
df5127560034
[gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
391
diff
changeset
|
57 There is a new event, event_quit, which signifies that gaim has exited |
|
df5127560034
[gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
391
diff
changeset
|
58 correctly (i.e. didn't segfault). Also, after this event is called, all |
|
404
3d94cc1dc424
[gaim-migrate @ 414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
398
diff
changeset
|
59 plugins are removed, and their gaim_plugin_remove function is called. |
|
392
df5127560034
[gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
391
diff
changeset
|
60 This behavior is different from previous versions; however, it is the |
|
df5127560034
[gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
391
diff
changeset
|
61 proper way of doing things, and should have no effect on current |
|
df5127560034
[gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
391
diff
changeset
|
62 plugins. The reason event_quit exists despite plugins being removed at |
|
df5127560034
[gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
391
diff
changeset
|
63 quit is because a plugin can be removed without gaim quitting. They are |
|
df5127560034
[gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
391
diff
changeset
|
64 distinctly separate events. |
|
df5127560034
[gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
391
diff
changeset
|
65 |
|
df5127560034
[gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
391
diff
changeset
|
66 The new events mean that some versions of gaim have certain events, |
|
df5127560034
[gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
391
diff
changeset
|
67 others don't. The thing I find fascinating though is that even if a |
|
df5127560034
[gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
391
diff
changeset
|
68 plugin is compiled for a later version, it will still be backwards- |
|
df5127560034
[gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
391
diff
changeset
|
69 compatible, even if it makes use of the newer events. The reason why |
|
df5127560034
[gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
391
diff
changeset
|
70 is the names of the events are stored as integers, and those integers |
|
df5127560034
[gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
391
diff
changeset
|
71 will never match an event in a prior version. This means you don't |
|
df5127560034
[gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
391
diff
changeset
|
72 have to worry about which version the person is using, only which |
|
df5127560034
[gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
391
diff
changeset
|
73 version the person is compiling against. For simplicity's sake, please |
|
df5127560034
[gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
391
diff
changeset
|
74 assume people are compiling against the latest version. For |
|
df5127560034
[gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
391
diff
changeset
|
75 practicality's sake, VERSION is #define'd to be the version you're |
|
df5127560034
[gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
391
diff
changeset
|
76 compiling against, starting with 0.9.20. Prior versions do not have |
|
df5127560034
[gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
391
diff
changeset
|
77 this defined in the standard plugin Makefile. |
