Mon, 12 Jun 2000 11:30:05 +0000
[gaim-migrate @ 401]
Plugins got updated.
| 391 | 1 | #define GAIM_PLUGINS |
| 2 | #include "gaim.h" | |
| 3 | ||
| 4 | #include <stdlib.h> | |
| 5 | #include <time.h> | |
| 6 | ||
| 7 | int gaim_plugin_init(void *handle) { | |
| 8 | int error; | |
| 9 | ||
| 10 | /* so here, we load any callbacks, do the normal stuff */ | |
| 11 | ||
| 12 | srand(time(NULL)); | |
| 13 | error = rand() % 3; | |
| 14 | /* there's a 1 in 3 chance there *won't* be an error :) */ | |
| 15 | return error; | |
| 16 | } | |
| 17 | ||
| 18 | void gaim_plugin_remove() { | |
| 19 | /* this only gets called if we get loaded successfully, and then | |
| 20 | * unloaded. */ | |
| 21 | } | |
| 22 | ||
| 23 | char *gaim_plugin_error(int error) { | |
| 24 | /* by the time we've gotten here, all our callbacks are removed. | |
| 25 | * we just have to deal with what the error was (as defined by us) | |
| 26 | * and do any other clean-up stuff we need to do. */ | |
| 27 | switch (error) { | |
| 28 | case 1: | |
| 29 | do_error_dialog("I'm calling the error myself", "MY BAD"); | |
| 30 | return NULL; | |
| 31 | case 2: | |
| 32 | return "Internal plugin error: exiting."; | |
| 33 | } | |
| 34 | /* we should never get here */ | |
| 35 | return NULL; | |
| 36 | } | |
| 37 | ||
| 38 | char *name() { | |
| 39 | return "Error Tester"; | |
| 40 | } | |
| 41 | ||
| 42 | char *description() { | |
| 43 | return "A nice little program that causes error messages"; | |
| 44 | } |