merge of 'd03c32ee4bd5625c28af8c8b33920944d499eef6'
[pidgin-git.git] / libpurple / plugins / ipc-test-client.c
bloba80834ffe73578aa3dd13153b0721a86737a2f43
1 /*
2 * IPC test client plugin.
4 * Copyright (C) 2003 Christian Hammond.
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.
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.
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., 51 Franklin Street, Fifth Floor, Boston, MA
19 * 02111-1301, USA.
21 #include "internal.h"
22 #include "debug.h"
23 #include "plugin.h"
24 #include "version.h"
26 #define IPC_TEST_CLIENT_PLUGIN_ID "core-ipc-test-client"
28 static gboolean
29 plugin_load(PurplePlugin *plugin)
31 PurplePlugin *server_plugin;
32 gboolean ok;
33 int result;
35 server_plugin = purple_plugins_find_with_id("core-ipc-test-server");
37 if (server_plugin == NULL)
39 purple_debug_error("ipc-test-client",
40 "Unable to locate plugin core-ipc-test-server, "
41 "needed for IPC.\n");
43 return TRUE;
46 result = (int)purple_plugin_ipc_call(server_plugin, "add", &ok, 36, 6);
48 if (!ok)
50 purple_debug_error("ipc-test-client",
51 "Unable to call IPC function 'add' in "
52 "core-ipc-test-server plugin.");
54 return TRUE;
57 purple_debug_info("ipc-test-client", "36 + 6 = %d\n", result);
59 result = (int)purple_plugin_ipc_call(server_plugin, "sub", &ok, 50, 8);
61 if (!ok)
63 purple_debug_error("ipc-test-client",
64 "Unable to call IPC function 'sub' in "
65 "core-ipc-test-server plugin.");
67 return TRUE;
70 purple_debug_info("ipc-test-client", "50 - 8 = %d\n", result);
72 return TRUE;
75 static PurplePluginInfo info =
77 PURPLE_PLUGIN_MAGIC,
78 PURPLE_MAJOR_VERSION,
79 PURPLE_MINOR_VERSION,
80 PURPLE_PLUGIN_STANDARD, /**< type */
81 NULL, /**< ui_requirement */
82 0, /**< flags */
83 NULL, /**< dependencies */
84 PURPLE_PRIORITY_DEFAULT, /**< priority */
86 IPC_TEST_CLIENT_PLUGIN_ID, /**< id */
87 N_("IPC Test Client"), /**< name */
88 DISPLAY_VERSION, /**< version */
89 /** summary */
90 N_("Test plugin IPC support, as a client."),
91 /** description */
92 N_("Test plugin IPC support, as a client. This locates the server "
93 "plugin and calls the commands registered."),
94 "Christian Hammond <chipx86@gnupdate.org>", /**< author */
95 PURPLE_WEBSITE, /**< homepage */
97 plugin_load, /**< load */
98 NULL, /**< unload */
99 NULL, /**< destroy */
101 NULL, /**< ui_info */
102 NULL, /**< extra_info */
103 NULL,
104 NULL
107 static void
108 init_plugin(PurplePlugin *plugin)
110 info.dependencies = g_list_append(info.dependencies,
111 "core-ipc-test-server");
114 PURPLE_INIT_PLUGIN(ipctestclient, init_plugin, info)