Mercurial > pidgin
annotate plugins/error.c @ 398:59d97cd251ff
[gaim-migrate @ 408]
this better work
committer: Tailor Script <tailor@pidgin.im>
| author | Eric Warmenhoven <eric@warmenhoven.org> |
|---|---|
| date | Mon, 12 Jun 2000 13:59:03 +0000 |
| parents | b1d5c6ab7b0d |
| children | ece2d1543b20 |
| rev | line source |
|---|---|
| 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
59d97cd251ff
[gaim-migrate @ 408]
Eric Warmenhoven <eric@warmenhoven.org>
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
59d97cd251ff
[gaim-migrate @ 408]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
396
diff
changeset
|
29 case -1: |
| 391 | 30 do_error_dialog("I'm calling the error myself", "MY BAD"); |
| 31 return NULL; | |
|
398
59d97cd251ff
[gaim-migrate @ 408]
Eric Warmenhoven <eric@warmenhoven.org>
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
b1d5c6ab7b0d
[gaim-migrate @ 406]
Eric Warmenhoven <eric@warmenhoven.org>
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 } |
