6822
|
1 /*
|
|
2 * IPC test client 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 #include "internal.h"
|
|
22 #include "debug.h"
|
|
23 #include "plugin.h"
|
|
24
|
|
25 #define IPC_TEST_CLIENT_PLUGIN_ID "core-ipc-test-client"
|
|
26
|
|
27 static gboolean
|
|
28 plugin_load(GaimPlugin *plugin)
|
|
29 {
|
|
30 GaimPlugin *server_plugin;
|
|
31 gboolean ok;
|
|
32 int result;
|
|
33
|
|
34 server_plugin = gaim_plugins_find_with_id("core-ipc-test-server");
|
|
35
|
|
36 if (server_plugin == NULL)
|
|
37 {
|
|
38 gaim_debug_error("ipc-test-client",
|
|
39 "Unable to locate plugin core-ipc-test-server, "
|
|
40 "needed for IPC.\n");
|
|
41
|
|
42 return TRUE;
|
|
43 }
|
|
44
|
|
45 result = (int)gaim_plugin_ipc_call(server_plugin, "add", &ok, 36, 6);
|
|
46
|
|
47 if (!ok)
|
|
48 {
|
|
49 gaim_debug_error("ipc-test-client",
|
|
50 "Unable to call IPC function 'add' in "
|
|
51 "core-ipc-test-server plugin.");
|
|
52
|
|
53 return TRUE;
|
|
54 }
|
|
55
|
|
56 gaim_debug_info("ipc-test-client", "36 + 6 = %d\n", result);
|
|
57
|
|
58 result = (int)gaim_plugin_ipc_call(server_plugin, "sub", &ok, 50, 8);
|
|
59
|
|
60 if (!ok)
|
|
61 {
|
|
62 gaim_debug_error("ipc-test-client",
|
|
63 "Unable to call IPC function 'sub' in "
|
|
64 "core-ipc-test-server plugin.");
|
|
65
|
|
66 return TRUE;
|
|
67 }
|
|
68
|
|
69 gaim_debug_info("ipc-test-client", "50 - 8 = %d\n", result);
|
|
70
|
|
71 return TRUE;
|
|
72 }
|
|
73
|
|
74 static GaimPluginInfo info =
|
|
75 {
|
|
76 2, /**< api_version */
|
|
77 GAIM_PLUGIN_STANDARD, /**< type */
|
|
78 NULL, /**< ui_requirement */
|
|
79 0, /**< flags */
|
|
80 NULL, /**< dependencies */
|
|
81 GAIM_PRIORITY_DEFAULT, /**< priority */
|
|
82
|
|
83 IPC_TEST_CLIENT_PLUGIN_ID, /**< id */
|
|
84 N_("IPC Test Client"), /**< name */
|
|
85 VERSION, /**< version */
|
|
86 /** summary */
|
|
87 N_("Test plugin IPC support, as a client."),
|
|
88 /** description */
|
|
89 N_("Test plugin IPC support, as a client. This locates the server "
|
|
90 "plugin and calls the commands registered."),
|
|
91 "Christian Hammond <chipx86@gnupdate.org>", /**< author */
|
|
92 GAIM_WEBSITE, /**< homepage */
|
|
93
|
|
94 plugin_load, /**< load */
|
|
95 NULL, /**< unload */
|
|
96 NULL, /**< destroy */
|
|
97
|
|
98 NULL, /**< ui_info */
|
|
99 NULL /**< extra_info */
|
|
100 };
|
|
101
|
|
102 static void
|
|
103 init_plugin(GaimPlugin *plugin)
|
|
104 {
|
|
105 info.dependencies = g_list_append(info.dependencies,
|
|
106 "core-ipc-test-server");
|
|
107 }
|
|
108
|
|
109 GAIM_INIT_PLUGIN(ipctestclient, init_plugin, info)
|