comparison plugins/ipc-test-server.c @ 6822:7dba3e17cb21

[gaim-migrate @ 7366] Added plugin IPC. Its use is shown in plugins/ipc-test-server.c and plugins/ipc-test-client.c. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Sat, 13 Sep 2003 09:31:03 +0000
parents
children d7b8eb1f0a18
comparison
equal deleted inserted replaced
6821:636b5215552e 6822:7dba3e17cb21
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 {
63 2, /**< api_version */
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 */
86 NULL /**< extra_info */
87 };
88
89 static void
90 init_plugin(GaimPlugin *plugin)
91 {
92 }
93
94 GAIM_INIT_PLUGIN(ipctestserver, init_plugin, info)