Thu, 26 Oct 2000 07:22:32 +0000
[gaim-migrate @ 1036]
X-Idle support. Thanks bryner and bmiller!
Both of you guys sent me similar patches :)
committer: Rob Flynn <gaim@robflynn.com>
| 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; | |
|
398
c426f81e75ce
[gaim-migrate @ 408]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
396
diff
changeset
|
14 | error -= 2; |
| 391 | 15 | /* there's a 1 in 3 chance there *won't* be an error :) */ |
| 16 | return error; | |
| 17 | } | |
| 18 | ||
| 19 | void gaim_plugin_remove() { | |
| 20 | /* this only gets called if we get loaded successfully, and then | |
| 21 | * unloaded. */ | |
| 22 | } | |
| 23 | ||
| 24 | char *gaim_plugin_error(int error) { | |
| 25 | /* 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) | |
| 27 | * and do any other clean-up stuff we need to do. */ | |
| 28 | switch (error) { | |
|
398
c426f81e75ce
[gaim-migrate @ 408]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
396
diff
changeset
|
29 | case -1: |
| 391 | 30 | do_error_dialog("I'm calling the error myself", "MY BAD"); |
| 31 | return NULL; | |
|
398
c426f81e75ce
[gaim-migrate @ 408]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
396
diff
changeset
|
32 | case -2: |
| 391 | 33 | return "Internal plugin error: exiting."; |
| 34 | } | |
| 35 | /* we should never get here */ | |
| 36 | return NULL; | |
| 37 | } | |
| 38 | ||
| 39 | char *name() { | |
|
396
fbdaa6b9fb14
[gaim-migrate @ 406]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
393
diff
changeset
|
40 | return "Error Tester " VERSION ; |
| 391 | 41 | } |
| 42 | ||
| 43 | char *description() { | |
| 44 | return "A nice little program that causes error messages"; | |
| 45 | } |