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"
9954
+ 鐃緒申 24 #include "version.h"
6822
+ 鐃緒申 25
+ 鐃緒申 26 #define IPC_TEST_CLIENT_PLUGIN_ID "core-ipc-test-client"
+ 鐃緒申 27
+ 鐃緒申 28 static gboolean
+ 鐃緒申 29 plugin_load(GaimPlugin *plugin)
+ 鐃緒申 30 {
+ 鐃緒申 31 GaimPlugin *server_plugin;
+ 鐃緒申 32 gboolean ok;
+ 鐃緒申 33 int result;
+ 鐃緒申 34
+ 鐃緒申 35 server_plugin = gaim_plugins_find_with_id("core-ipc-test-server");
+ 鐃緒申 36
+ 鐃緒申 37 if (server_plugin == NULL)
+ 鐃緒申 38 {
+ 鐃緒申 39 gaim_debug_error("ipc-test-client",
+ 鐃緒申 40 "Unable to locate plugin core-ipc-test-server, "
+ 鐃緒申 41 "needed for IPC.\n");
+ 鐃緒申 42
+ 鐃緒申 43 return TRUE;
+ 鐃緒申 44 }
+ 鐃緒申 45
+ 鐃緒申 46 result = (int)gaim_plugin_ipc_call(server_plugin, "add", &ok, 36, 6);
+ 鐃緒申 47
+ 鐃緒申 48 if (!ok)
+ 鐃緒申 49 {
+ 鐃緒申 50 gaim_debug_error("ipc-test-client",
+ 鐃緒申 51 "Unable to call IPC function 'add' in "
+ 鐃緒申 52 "core-ipc-test-server plugin.");
+ 鐃緒申 53
+ 鐃緒申 54 return TRUE;
+ 鐃緒申 55 }
+ 鐃緒申 56
+ 鐃緒申 57 gaim_debug_info("ipc-test-client", "36 + 6 = %d\n", result);
+ 鐃緒申 58
+ 鐃緒申 59 result = (int)gaim_plugin_ipc_call(server_plugin, "sub", &ok, 50, 8);
+ 鐃緒申 60
+ 鐃緒申 61 if (!ok)
+ 鐃緒申 62 {
+ 鐃緒申 63 gaim_debug_error("ipc-test-client",
+ 鐃緒申 64 "Unable to call IPC function 'sub' in "
+ 鐃緒申 65 "core-ipc-test-server plugin.");
+ 鐃緒申 66
+ 鐃緒申 67 return TRUE;
+ 鐃緒申 68 }
+ 鐃緒申 69
+ 鐃緒申 70 gaim_debug_info("ipc-test-client", "50 - 8 = %d\n", result);
+ 鐃緒申 71
+ 鐃緒申 72 return TRUE;
+ 鐃緒申 73 }
+ 鐃緒申 74
+ 鐃緒申 75 static GaimPluginInfo info =
+ 鐃緒申 76 {
9954
+ 鐃緒申 77 GAIM_PLUGIN_MAGIC,
+ 鐃緒申 78 GAIM_MAJOR_VERSION,
+ 鐃緒申 79 GAIM_MINOR_VERSION,
6822
+ 鐃緒申 80 GAIM_PLUGIN_STANDARD, /**< type */
+ 鐃緒申 81 NULL, /**< ui_requirement */
+ 鐃緒申 82 0, /**< flags */
+ 鐃緒申 83 NULL, /**< dependencies */
+ 鐃緒申 84 GAIM_PRIORITY_DEFAULT, /**< priority */
+ 鐃緒申 85
+ 鐃緒申 86 IPC_TEST_CLIENT_PLUGIN_ID, /**< id */
+ 鐃緒申 87 N_("IPC Test Client"), /**< name */
+ 鐃緒申 88 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 GAIM_WEBSITE, /**< homepage */
+ 鐃緒申 96
+ 鐃緒申 97 plugin_load, /**< load */
+ 鐃緒申 98 NULL, /**< unload */
+ 鐃緒申 99 NULL, /**< destroy */
+ 鐃緒申 100
+ 鐃緒申 101 NULL, /**< ui_info */
8993
+ 鐃緒申 102 NULL, /**< extra_info */
+ 鐃緒申 103 NULL,
+ 鐃緒申 104 NULL
6822
+ 鐃緒申 105 };
+ 鐃緒申 106
+ 鐃緒申 107 static void
+ 鐃緒申 108 init_plugin(GaimPlugin *plugin)
+ 鐃緒申 109 {
+ 鐃緒申 110 info.dependencies = g_list_append(info.dependencies,
+ 鐃緒申 111 "core-ipc-test-server");
+ 鐃緒申 112 }
+ 鐃緒申 113
+ 鐃緒申 114 GAIM_INIT_PLUGIN(ipctestclient, init_plugin, info)