Mercurial > pidgin
annotate plugins/ipc-test-server.c @ 9697:f568b6655331
[gaim-migrate @ 10556]
I'm not sure how this wasn't noticed before, but thanks to hyphenated for
pointing it out. We were checking if the load function pointer was valid
before calling unload. We should have checked unload.
committer: Tailor Script <tailor@pidgin.im>
| author | Christian Hammond <chipx86@chipx86.com> |
|---|---|
| date | Sat, 07 Aug 2004 09:07:20 +0000 |
| parents | 294ae6548d4e |
| children | a9fb4493ae22 |
| rev | line source |
|---|---|
| 6822 | 1 /* |
| 2 * IPC test server plugin. | |
| 3 * | |
| 4 * Copyright (C) 2003 Christian Hammond. | |
| 5 * | |
| 6 * This program is free software; you can redistribute it and/or | |
| 7 * modify it under the terms of the GNU General Public License as | |
| 8 * published by the Free Software Foundation; either version 2 of the | |
| 9 * License, or (at your option) any later version. | |
| 10 * | |
| 11 * This program is distributed in the hope that it will be useful, but | |
| 12 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 14 * General Public License for more details. | |
| 15 * | |
| 16 * You should have received a copy of the GNU General Public License | |
| 17 * along with this program; if not, write to the Free Software | |
| 18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | |
| 19 * 02111-1307, USA. | |
| 20 */ | |
| 21 #define IPC_TEST_SERVER_PLUGIN_ID "core-ipc-test-server" | |
| 22 | |
| 23 #include "internal.h" | |
| 24 #include "debug.h" | |
| 25 #include "plugin.h" | |
| 26 | |
| 27 static int | |
| 28 add_func(int i1, int i2) | |
| 29 { | |
| 30 gaim_debug_misc("ipc-test-server", "Got %d, %d, returning %d\n", | |
| 31 i1, i2, i1 + i2); | |
| 32 return i1 + i2; | |
| 33 } | |
| 34 | |
| 35 static int | |
| 36 sub_func(int i1, int i2) | |
| 37 { | |
| 38 gaim_debug_misc("ipc-test-server", "Got %d, %d, returning %d\n", | |
| 39 i1, i2, i1 - i2); | |
| 40 return i1 - i2; | |
| 41 } | |
| 42 | |
| 43 static gboolean | |
| 44 plugin_load(GaimPlugin *plugin) | |
| 45 { | |
| 46 gaim_plugin_ipc_register(plugin, "add", GAIM_CALLBACK(add_func), | |
| 47 gaim_marshal_INT__INT_INT, | |
| 48 gaim_value_new(GAIM_TYPE_INT), 2, | |
| 49 gaim_value_new(GAIM_TYPE_INT), | |
| 50 gaim_value_new(GAIM_TYPE_INT)); | |
| 51 | |
| 52 gaim_plugin_ipc_register(plugin, "sub", GAIM_CALLBACK(sub_func), | |
| 53 gaim_marshal_INT__INT_INT, | |
| 54 gaim_value_new(GAIM_TYPE_INT), 2, | |
| 55 gaim_value_new(GAIM_TYPE_INT), | |
| 56 gaim_value_new(GAIM_TYPE_INT)); | |
| 57 | |
| 58 return TRUE; | |
| 59 } | |
| 60 | |
| 61 static GaimPluginInfo info = | |
| 62 { | |
|
8749
d7b8eb1f0a18
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
6822
diff
changeset
|
63 GAIM_PLUGIN_API_VERSION, /**< api_version */ |
| 6822 | 64 GAIM_PLUGIN_STANDARD, /**< type */ |
| 65 NULL, /**< ui_requirement */ | |
| 66 0, /**< flags */ | |
| 67 NULL, /**< dependencies */ | |
| 68 GAIM_PRIORITY_DEFAULT, /**< priority */ | |
| 69 | |
| 70 IPC_TEST_SERVER_PLUGIN_ID, /**< id */ | |
| 71 N_("IPC Test Server"), /**< name */ | |
| 72 VERSION, /**< version */ | |
| 73 /** summary */ | |
| 74 N_("Test plugin IPC support, as a server."), | |
| 75 /** description */ | |
| 76 N_("Test plugin IPC support, as a server. This registers the IPC " | |
| 77 "commands."), | |
| 78 "Christian Hammond <chipx86@gnupdate.org>", /**< author */ | |
| 79 GAIM_WEBSITE, /**< homepage */ | |
| 80 | |
| 81 plugin_load, /**< load */ | |
| 82 NULL, /**< unload */ | |
| 83 NULL, /**< destroy */ | |
| 84 | |
| 85 NULL, /**< ui_info */ | |
| 8993 | 86 NULL, /**< extra_info */ |
| 87 NULL, | |
| 88 NULL | |
| 6822 | 89 }; |
| 90 | |
| 91 static void | |
| 92 init_plugin(GaimPlugin *plugin) | |
| 93 { | |
| 94 } | |
| 95 | |
| 96 GAIM_INIT_PLUGIN(ipctestserver, init_plugin, info) |
