Mercurial > pidgin
comparison plugins/error.c @ 1047:ece2d1543b20
[gaim-migrate @ 1057]
Plugins now use GModule. Protocol plugins can be dynamically updated.
committer: Tailor Script <tailor@pidgin.im>
| author | Eric Warmenhoven <eric@warmenhoven.org> |
|---|---|
| date | Wed, 01 Nov 2000 22:30:36 +0000 |
| parents | 59d97cd251ff |
| children | cd938f18f3f8 |
comparison
equal
deleted
inserted
replaced
| 1046:4593605da0e2 | 1047:ece2d1543b20 |
|---|---|
| 2 #include "gaim.h" | 2 #include "gaim.h" |
| 3 | 3 |
| 4 #include <stdlib.h> | 4 #include <stdlib.h> |
| 5 #include <time.h> | 5 #include <time.h> |
| 6 | 6 |
| 7 int gaim_plugin_init(void *handle) { | 7 char *gaim_plugin_error(int); |
| 8 | |
| 9 char *gaim_plugin_init(GModule *handle) { | |
| 8 int error; | 10 int error; |
| 9 | 11 |
| 10 /* so here, we load any callbacks, do the normal stuff */ | 12 /* so here, we load any callbacks, do the normal stuff */ |
| 11 | 13 |
| 12 srand(time(NULL)); | 14 srand(time(NULL)); |
| 13 error = rand() % 3; | 15 error = rand() % 3; |
| 14 error -= 2; | 16 error -= 2; |
| 15 /* there's a 1 in 3 chance there *won't* be an error :) */ | 17 /* there's a 1 in 3 chance there *won't* be an error :) */ |
| 16 return error; | 18 return gaim_plugin_error(error); |
| 17 } | 19 } |
| 18 | 20 |
| 19 void gaim_plugin_remove() { | 21 void gaim_plugin_remove() { |
| 20 /* this only gets called if we get loaded successfully, and then | 22 /* this only gets called if we get loaded successfully, and then |
| 21 * unloaded. */ | 23 * unloaded. */ |
| 25 /* by the time we've gotten here, all our callbacks are removed. | 27 /* by the time we've gotten here, all our callbacks are removed. |
| 26 * we just have to deal with what the error was (as defined by us) | 28 * we just have to deal with what the error was (as defined by us) |
| 27 * and do any other clean-up stuff we need to do. */ | 29 * and do any other clean-up stuff we need to do. */ |
| 28 switch (error) { | 30 switch (error) { |
| 29 case -1: | 31 case -1: |
| 30 do_error_dialog("I'm calling the error myself", "MY BAD"); | 32 return "MY BAD"; |
| 31 return NULL; | |
| 32 case -2: | 33 case -2: |
| 33 return "Internal plugin error: exiting."; | 34 return "Internal plugin error: exiting."; |
| 35 default: | |
| 36 return NULL; | |
| 34 } | 37 } |
| 35 /* we should never get here */ | |
| 36 return NULL; | |
| 37 } | 38 } |
| 38 | 39 |
| 39 char *name() { | 40 char *name() { |
| 40 return "Error Tester " VERSION ; | 41 return "Error Tester " VERSION ; |
| 41 } | 42 } |
