Sat, 13 Sep 2003 09:31:03 +0000
[gaim-migrate @ 7366]
Added plugin IPC. Its use is shown in plugins/ipc-test-server.c and
plugins/ipc-test-client.c.
| 5205 | 1 | /** |
| 2 | * @file plugin.h Plugin API | |
| 3 | * @ingroup core | |
| 4 | * | |
| 5 | * gaim | |
| 6 | * | |
| 7 | * Copyright (C) 2003 Christian Hammond <chipx86@gnupdate.org> | |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
5949
diff
changeset
|
8 | * |
| 5205 | 9 | * This program is free software; you can redistribute it and/or modify |
| 10 | * it under the terms of the GNU General Public License as published by | |
| 11 | * the Free Software Foundation; either version 2 of the License, or | |
| 12 | * (at your option) any later version. | |
| 13 | * | |
| 14 | * This program is distributed in the hope that it will be useful, | |
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 17 | * GNU General Public License for more details. | |
| 18 | * | |
| 19 | * You should have received a copy of the GNU General Public License | |
| 20 | * along with this program; if not, write to the Free Software | |
| 21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 22 | */ | |
| 23 | #ifndef _GAIM_PLUGIN_H_ | |
| 24 | #define _GAIM_PLUGIN_H_ | |
|
5944
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
25 | |
|
5224
8cb89f5b912a
[gaim-migrate @ 5594]
Herman Bloggs <herman@bluedigits.com>
parents:
5205
diff
changeset
|
26 | #include <gmodule.h> |
|
6822
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
27 | #include "signals.h" |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
28 | #include "value.h" |
| 5205 | 29 | |
| 30 | typedef struct _GaimPlugin GaimPlugin; /**< GaimPlugin */ | |
| 31 | typedef struct _GaimPluginInfo GaimPluginInfo; /**< GaimPluginInfo */ | |
| 32 | typedef struct _GaimPluginLoaderInfo GaimPluginLoaderInfo; | |
| 33 | ||
| 34 | typedef int GaimPluginPriority; /**< Plugin priority. */ | |
| 35 | ||
| 36 | /** | |
| 37 | * Plugin types. | |
| 38 | */ | |
|
5944
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
39 | typedef enum |
| 5205 | 40 | { |
| 41 | GAIM_PLUGIN_UNKNOWN = -1, /**< Unknown type. */ | |
| 42 | GAIM_PLUGIN_STANDARD = 0, /**< Standard plugin. */ | |
| 43 | GAIM_PLUGIN_LOADER, /**< Loader plugin. */ | |
| 44 | GAIM_PLUGIN_PROTOCOL /**< Protocol plugin. */ | |
|
5944
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
45 | |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
46 | } GaimPluginType; |
| 5205 | 47 | |
| 48 | #define GAIM_PRIORITY_DEFAULT 0 | |
| 49 | #define GAIM_PRIORITY_HIGHEST 9999 | |
| 50 | #define GAIM_PRIORITY_LOWEST -9999 | |
| 51 | ||
| 52 | /** | |
| 53 | * Detailed information about a plugin. | |
| 54 | * | |
| 55 | * This is used in the version 2.0 API and up. | |
| 56 | */ | |
| 57 | struct _GaimPluginInfo | |
| 58 | { | |
| 59 | unsigned int api_version; | |
| 60 | GaimPluginType type; | |
| 61 | char *ui_requirement; | |
| 62 | unsigned long flags; | |
| 63 | GList *dependencies; | |
| 64 | GaimPluginPriority priority; | |
| 65 | ||
| 66 | char *id; | |
| 67 | char *name; | |
| 68 | char *version; | |
| 69 | char *summary; | |
| 70 | char *description; | |
| 71 | char *author; | |
| 72 | char *homepage; | |
| 73 | ||
| 74 | gboolean (*load)(GaimPlugin *plugin); | |
| 75 | gboolean (*unload)(GaimPlugin *plugin); | |
| 76 | void (*destroy)(GaimPlugin *plugin); | |
| 77 | ||
| 78 | void *ui_info; | |
| 79 | void *extra_info; | |
| 80 | }; | |
| 81 | ||
| 82 | /** | |
| 83 | * Extra information for loader plugins. | |
| 84 | */ | |
| 85 | struct _GaimPluginLoaderInfo | |
| 86 | { | |
| 87 | GList *exts; | |
| 88 | ||
| 89 | gboolean (*probe)(GaimPlugin *plugin); | |
| 90 | gboolean (*load)(GaimPlugin *plugin); | |
| 91 | gboolean (*unload)(GaimPlugin *plugin); | |
| 92 | void (*destroy)(GaimPlugin *plugin); | |
| 93 | }; | |
| 94 | ||
| 95 | /** | |
| 96 | * A plugin handle. | |
| 97 | */ | |
| 98 | struct _GaimPlugin | |
| 99 | { | |
| 100 | gboolean native_plugin; /**< Native C plugin. */ | |
| 101 | gboolean loaded; /**< The loaded state. */ | |
| 102 | void *handle; /**< The module handle. */ | |
| 103 | char *path; /**< The path to the plugin. */ | |
| 104 | GaimPluginInfo *info; /**< The plugin information. */ | |
| 105 | char *error; | |
|
6822
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
106 | void *ipc_data; /**< IPC data. */ |
| 5205 | 107 | void *extra; /**< Plugin-specific data. */ |
| 108 | }; | |
| 109 | ||
| 110 | #define GAIM_PLUGIN_LOADER_INFO(plugin) \ | |
| 111 | ((GaimPluginLoaderInfo *)(plugin)->info->extra_info) | |
| 112 | ||
| 113 | /** | |
| 114 | * Handles the initialization of modules. | |
| 115 | */ | |
|
5449
4c350eb7d4a0
[gaim-migrate @ 5836]
Decklin Foster <decklin@red-bean.com>
parents:
5242
diff
changeset
|
116 | #ifndef GAIM_PLUGINS |
| 5205 | 117 | # define GAIM_INIT_PLUGIN(pluginname, initfunc, plugininfo) \ |
| 118 | gboolean gaim_init_##pluginname##_plugin(void) { \ | |
| 119 | GaimPlugin *plugin = gaim_plugin_new(TRUE, NULL); \ | |
| 120 | plugin->info = &(plugininfo); \ | |
| 121 | initfunc((plugin)); \ | |
| 122 | return gaim_plugin_register(plugin); \ | |
| 123 | } | |
|
5449
4c350eb7d4a0
[gaim-migrate @ 5836]
Decklin Foster <decklin@red-bean.com>
parents:
5242
diff
changeset
|
124 | #else /* GAIM_PLUGINS */ |
| 5205 | 125 | # define GAIM_INIT_PLUGIN(pluginname, initfunc, plugininfo) \ |
|
5224
8cb89f5b912a
[gaim-migrate @ 5594]
Herman Bloggs <herman@bluedigits.com>
parents:
5205
diff
changeset
|
126 | G_MODULE_EXPORT gboolean gaim_init_plugin(GaimPlugin *plugin) { \ |
| 5205 | 127 | plugin->info = &(plugininfo); \ |
| 128 | initfunc((plugin)); \ | |
| 129 | return gaim_plugin_register(plugin); \ | |
| 130 | } | |
| 131 | #endif | |
| 132 | ||
|
5944
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
133 | #ifdef __cplusplus |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
134 | extern "C" { |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
135 | #endif |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
136 | |
| 5205 | 137 | /**************************************************************************/ |
|
5944
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
138 | /** @name Plugin API */ |
| 5205 | 139 | /**************************************************************************/ |
| 140 | /*@{*/ | |
| 141 | ||
| 142 | /** | |
| 143 | * Creates a new plugin structure. | |
| 144 | * | |
| 145 | * @param native Whether or not the plugin is native. | |
| 146 | * @param path The path to the plugin, or @c NULL if statically compiled. | |
| 147 | * | |
| 148 | * @return A new GaimPlugin structure. | |
| 149 | */ | |
| 150 | GaimPlugin *gaim_plugin_new(gboolean native, const char *path); | |
| 151 | ||
| 152 | /** | |
| 153 | * Probes a plugin, retrieving the information on it and adding it to the | |
| 154 | * list of available plugins. | |
| 155 | * | |
| 156 | * @param filename The plugin's filename. | |
| 157 | * | |
| 158 | * @return The plugin handle. | |
| 159 | * | |
| 160 | * @see gaim_plugin_load() | |
| 161 | * @see gaim_plugin_destroy() | |
| 162 | */ | |
| 163 | GaimPlugin *gaim_plugin_probe(const char *filename); | |
| 164 | ||
| 165 | /** | |
| 166 | * Registers a plugin and prepares it for loading. | |
| 167 | * | |
| 168 | * This shouldn't be called by anything but the internal module code. | |
| 169 | * | |
| 170 | * @param plugin The plugin to register. | |
| 171 | */ | |
| 172 | gboolean gaim_plugin_register(GaimPlugin *plugin); | |
| 173 | ||
| 174 | /** | |
| 175 | * Attempts to load a previously probed plugin. | |
| 176 | * | |
|
6720
cdc5348dd848
[gaim-migrate @ 7247]
Christian Hammond <chipx86@chipx86.com>
parents:
6486
diff
changeset
|
177 | * @param plugin The plugin to load. |
| 5205 | 178 | * |
| 179 | * @return @c TRUE if successful, or @c FALSE otherwise. | |
| 180 | * | |
| 181 | * @see gaim_plugin_reload() | |
| 182 | * @see gaim_plugin_unload() | |
| 183 | */ | |
| 184 | gboolean gaim_plugin_load(GaimPlugin *plugin); | |
| 185 | ||
| 186 | /** | |
| 187 | * Unloads the specified plugin. | |
| 188 | * | |
| 189 | * @param plugin The plugin handle. | |
| 190 | * | |
| 191 | * @return @c TRUE if successful, or @c FALSE otherwise. | |
| 192 | * | |
| 193 | * @see gaim_plugin_load() | |
| 194 | * @see gaim_plugin_reload() | |
| 195 | */ | |
| 196 | gboolean gaim_plugin_unload(GaimPlugin *plugin); | |
| 197 | ||
| 198 | /** | |
| 199 | * Reloads a plugin. | |
| 200 | * | |
| 201 | * @param plugin The old plugin handle. | |
|
6486
18da8fdbc85b
[gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
202 | * |
| 5205 | 203 | * @return @c TRUE if successful, or @c FALSE otherwise. |
| 204 | * | |
| 205 | * @see gaim_plugin_load() | |
| 206 | * @see gaim_plugin_unload() | |
| 207 | */ | |
| 208 | gboolean gaim_plugin_reload(GaimPlugin *plugin); | |
| 209 | ||
| 210 | /** | |
| 211 | * Unloads a plugin and destroys the structure from memory. | |
| 212 | * | |
| 213 | * @param plugin The plugin handle. | |
| 214 | */ | |
| 215 | void gaim_plugin_destroy(GaimPlugin *plugin); | |
| 216 | ||
| 217 | /** | |
| 218 | * Returns whether or not a plugin is currently loaded. | |
| 219 | * | |
| 220 | * @param plugin The plugin. | |
| 221 | * | |
| 222 | * @return TRUE if loaded, or FALSE otherwise. | |
| 223 | */ | |
| 224 | gboolean gaim_plugin_is_loaded(const GaimPlugin *plugin); | |
| 225 | ||
| 226 | /*@}*/ | |
| 227 | ||
| 228 | /**************************************************************************/ | |
|
6822
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
229 | /** @name Plugin IPC API */ |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
230 | /**************************************************************************/ |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
231 | /*@{*/ |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
232 | |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
233 | /** |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
234 | * Registers an IPC command in a plugin. |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
235 | * |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
236 | * @param plugin The plugin to register the command with. |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
237 | * @param command The name of the command. |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
238 | * @param func The function to execute. |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
239 | * @param marshal The marshalling function. |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
240 | * @param ret_value The return value type. |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
241 | * @param num_values The number of parameters. |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
242 | * @param ... The parameter types. |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
243 | * |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
244 | * @return TRUE if the function was registered successfully, or |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
245 | * FALSE otherwise. |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
246 | */ |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
247 | gboolean gaim_plugin_ipc_register(GaimPlugin *plugin, const char *command, |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
248 | GaimCallback func, |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
249 | GaimSignalMarshalFunc marshal, |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
250 | GaimValue *ret_value, int num_params, ...); |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
251 | |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
252 | /** |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
253 | * Unregisters an IPC command in a plugin. |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
254 | * |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
255 | * @param plugin The plugin to unregister the command from. |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
256 | * @param command The name of the command. |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
257 | */ |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
258 | void gaim_plugin_ipc_unregister(GaimPlugin *plugin, const char *command); |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
259 | |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
260 | /** |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
261 | * Unregisters all IPC commands in a plugin. |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
262 | * |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
263 | * @param plugin The plugin to unregister the commands from. |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
264 | */ |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
265 | void gaim_plugin_ipc_unregister_all(GaimPlugin *plugin); |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
266 | |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
267 | /** |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
268 | * Returns a list of value types used for an IPC command. |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
269 | * |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
270 | * @param plugin The plugin. |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
271 | * @param command The name of the command. |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
272 | * @param ret_value The returned return value. |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
273 | * @param num_params The returned number of parameters. |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
274 | * @param params The returned list of parameters. |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
275 | * |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
276 | * @return TRUE if the command was found, or FALSE otherwise. |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
277 | */ |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
278 | gboolean gaim_plugin_ipc_get_params(GaimPlugin *plugin, const char *command, |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
279 | GaimValue **ret_value, int *num_params, |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
280 | GaimValue ***params); |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
281 | |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
282 | /** |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
283 | * Executes an IPC command. |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
284 | * |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
285 | * @param plugin The plugin to execute the command on. |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
286 | * @param command The name of the command. |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
287 | * @param ok TRUE if the call was successful, or FALSE otherwise. |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
288 | * @param ... The parameters to pass. |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
289 | * |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
290 | * @return The return value, which will be NULL if the command doesn't |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
291 | * return a value. |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
292 | */ |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
293 | void *gaim_plugin_ipc_call(GaimPlugin *plugin, const char *command, |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
294 | gboolean *ok, ...); |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
295 | |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
296 | /*@}*/ |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
297 | |
|
4adcde13ad17
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
298 | /**************************************************************************/ |
|
5944
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
299 | /** @name Plugins API */ |
| 5205 | 300 | /**************************************************************************/ |
| 301 | /*@{*/ | |
| 302 | ||
| 303 | /** | |
| 304 | * Sets the search paths for plugins. | |
| 305 | * | |
| 306 | * @param count The number of search paths. | |
| 307 | * @param paths The search paths. | |
| 308 | */ | |
| 309 | void gaim_plugins_set_search_paths(size_t count, char **paths); | |
| 310 | ||
| 311 | /** | |
|
5242
155da5e9bbf0
[gaim-migrate @ 5613]
Christian Hammond <chipx86@chipx86.com>
parents:
5224
diff
changeset
|
312 | * Unloads all loaded plugins. |
| 5205 | 313 | */ |
| 314 | void gaim_plugins_unload_all(void); | |
| 315 | ||
|
5242
155da5e9bbf0
[gaim-migrate @ 5613]
Christian Hammond <chipx86@chipx86.com>
parents:
5224
diff
changeset
|
316 | /** |
|
155da5e9bbf0
[gaim-migrate @ 5613]
Christian Hammond <chipx86@chipx86.com>
parents:
5224
diff
changeset
|
317 | * Destroys all registered plugins. |
|
155da5e9bbf0
[gaim-migrate @ 5613]
Christian Hammond <chipx86@chipx86.com>
parents:
5224
diff
changeset
|
318 | */ |
|
155da5e9bbf0
[gaim-migrate @ 5613]
Christian Hammond <chipx86@chipx86.com>
parents:
5224
diff
changeset
|
319 | void gaim_plugins_destroy_all(void); |
|
155da5e9bbf0
[gaim-migrate @ 5613]
Christian Hammond <chipx86@chipx86.com>
parents:
5224
diff
changeset
|
320 | |
| 5205 | 321 | /** |
|
5949
bb7cbf02dda9
[gaim-migrate @ 6393]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
322 | * Attempts to load all the plugins in the specified preference key |
|
bb7cbf02dda9
[gaim-migrate @ 6393]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
323 | * that were loaded when gaim last quit. |
|
bb7cbf02dda9
[gaim-migrate @ 6393]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
324 | * |
|
bb7cbf02dda9
[gaim-migrate @ 6393]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
325 | * @param key The preference key containing the list of plugins. |
| 5838 | 326 | */ |
|
5949
bb7cbf02dda9
[gaim-migrate @ 6393]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
327 | void gaim_plugins_load_saved(const char *key); |
| 5838 | 328 | |
| 329 | /** | |
| 5205 | 330 | * Probes for plugins in the registered module paths. |
| 331 | * | |
| 332 | * @param ext The extension type to probe for, or @c NULL for all. | |
| 333 | * | |
| 334 | * @see gaim_plugin_set_probe_path() | |
| 335 | */ | |
| 336 | void gaim_plugins_probe(const char *ext); | |
| 337 | ||
| 338 | /** | |
| 339 | * Returns whether or not plugin support is enabled. | |
| 340 | * | |
| 341 | * @return TRUE if plugin support is enabled, or FALSE otherwise. | |
| 342 | */ | |
| 343 | gboolean gaim_plugins_enabled(void); | |
| 344 | ||
| 345 | /** | |
| 346 | * Registers a function that will be called when probing is finished. | |
| 347 | * | |
| 348 | * @param func The callback function. | |
| 349 | * @param data Data to pass to the callback. | |
| 350 | */ | |
| 351 | void gaim_plugins_register_probe_notify_cb(void (*func)(void *), void *data); | |
| 352 | ||
| 353 | /** | |
| 354 | * Unregisters a function that would be called when probing is finished. | |
| 355 | * | |
| 356 | * @param func The callback function. | |
| 357 | */ | |
| 358 | void gaim_plugins_unregister_probe_notify_cb(void (*func)(void *)); | |
| 359 | ||
| 360 | /** | |
| 361 | * Registers a function that will be called when a plugin is loaded. | |
| 362 | * | |
| 363 | * @param func The callback functino. | |
| 364 | * @param data Data to pass to the callback. | |
| 365 | */ | |
| 366 | void gaim_plugins_register_load_notify_cb(void (*func)(GaimPlugin *, void *), | |
| 367 | void *data); | |
| 368 | ||
| 369 | /** | |
| 370 | * Unregisters a function that would be called when a plugin is loaded. | |
| 371 | * | |
| 372 | * @param func The callback functino. | |
| 373 | */ | |
| 374 | void gaim_plugins_unregister_load_notify_cb(void (*func)(GaimPlugin *, void *)); | |
| 375 | ||
| 376 | /** | |
| 377 | * Registers a function that will be called when a plugin is unloaded. | |
| 378 | * | |
| 379 | * @param func The callback functino. | |
| 380 | * @param data Data to pass to the callback. | |
| 381 | */ | |
| 382 | void gaim_plugins_register_unload_notify_cb(void (*func)(GaimPlugin *, void *), | |
| 383 | void *data); | |
| 384 | ||
| 385 | /** | |
| 386 | * Unregisters a function that would be called when a plugin is unloaded. | |
| 387 | * | |
| 388 | * @param func The callback functino. | |
| 389 | */ | |
| 390 | void gaim_plugins_unregister_unload_notify_cb(void (*func)(GaimPlugin *, | |
| 391 | void *)); | |
| 392 | ||
| 393 | /** | |
| 394 | * Finds a plugin with the specified name. | |
| 395 | * | |
| 396 | * @param name The plugin name. | |
| 397 | * | |
| 398 | * @return The plugin if found, or @c NULL if not found. | |
| 399 | */ | |
| 400 | GaimPlugin *gaim_plugins_find_with_name(const char *name); | |
| 401 | ||
| 402 | /** | |
| 403 | * Finds a plugin with the specified filename. | |
| 404 | * | |
| 405 | * @param filename The plugin filename. | |
| 406 | * | |
| 407 | * @return The plugin if found, or @c NULL if not found. | |
| 408 | */ | |
| 409 | GaimPlugin *gaim_plugins_find_with_filename(const char *filename); | |
| 410 | ||
| 411 | /** | |
| 412 | * Finds a plugin with the specified plugin ID. | |
| 413 | * | |
| 414 | * @param id The plugin ID. | |
| 415 | * | |
| 416 | * @return The plugin if found, or @c NULL if not found. | |
| 417 | */ | |
| 418 | GaimPlugin *gaim_plugins_find_with_id(const char *id); | |
| 419 | ||
| 420 | /** | |
| 421 | * Returns a list of all loaded plugins. | |
| 422 | * | |
|
5573
633880e3f137
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5449
diff
changeset
|
423 | * @return A list of all loaded plugins. |
| 5205 | 424 | */ |
| 425 | GList *gaim_plugins_get_loaded(void); | |
| 426 | ||
| 427 | /** | |
|
5573
633880e3f137
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5449
diff
changeset
|
428 | * Returns a list of all protocol plugins. |
|
633880e3f137
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5449
diff
changeset
|
429 | * |
|
633880e3f137
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5449
diff
changeset
|
430 | * @return A list of all protocol plugins. |
|
633880e3f137
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5449
diff
changeset
|
431 | */ |
|
633880e3f137
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5449
diff
changeset
|
432 | GList *gaim_plugins_get_protocols(void); |
|
633880e3f137
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5449
diff
changeset
|
433 | |
|
633880e3f137
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5449
diff
changeset
|
434 | /** |
| 5205 | 435 | * Returns a list of all plugins, whether loaded or not. |
| 436 | * | |
| 437 | * @return A list of all plugins. | |
| 438 | */ | |
| 439 | GList *gaim_plugins_get_all(void); | |
| 440 | ||
| 441 | /*@}*/ | |
| 442 | ||
|
5944
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
443 | #ifdef __cplusplus |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
444 | } |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
445 | #endif |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
446 | |
| 5205 | 447 | #endif /* _GAIM_PLUGIN_H_ */ |