Mercurial > pidgin
annotate src/plugin.h @ 10479:12460aa2c820
[gaim-migrate @ 11766]
grim made me do it
committer: Tailor Script <tailor@pidgin.im>
| author | Nathan Walp <nwalp@pidgin.im> |
|---|---|
| date | Thu, 06 Jan 2005 06:16:50 +0000 |
| parents | 577fdf4110fc |
| children | 1a97d5e88d12 |
| rev | line source |
|---|---|
| 5205 | 1 /** |
| 2 * @file plugin.h Plugin API | |
| 3 * @ingroup core | |
| 4 * | |
| 5 * gaim | |
| 6 * | |
| 8046 | 7 * Gaim is the legal property of its developers, whose names are too numerous |
| 8 * to list here. Please refer to the COPYRIGHT file distributed with this | |
| 9 * source distribution. | |
|
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
5949
diff
changeset
|
10 * |
| 5205 | 11 * This program is free software; you can redistribute it and/or modify |
| 12 * it under the terms of the GNU General Public License as published by | |
| 13 * the Free Software Foundation; either version 2 of the License, or | |
| 14 * (at your option) any later version. | |
| 15 * | |
| 16 * This program is distributed in the hope that it will be useful, | |
| 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 19 * GNU General Public License for more details. | |
| 20 * | |
| 21 * You should have received a copy of the GNU General Public License | |
| 22 * along with this program; if not, write to the Free Software | |
| 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 24 */ | |
| 25 #ifndef _GAIM_PLUGIN_H_ | |
| 26 #define _GAIM_PLUGIN_H_ | |
|
5944
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
27 |
| 8986 | 28 #include <glib/glist.h> |
|
5224
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5205
diff
changeset
|
29 #include <gmodule.h> |
|
6822
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
30 #include "signals.h" |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
31 #include "value.h" |
| 5205 | 32 |
|
8749
d7b8eb1f0a18
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
33 typedef struct _GaimPlugin GaimPlugin; |
|
d7b8eb1f0a18
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
34 typedef struct _GaimPluginInfo GaimPluginInfo; |
|
d7b8eb1f0a18
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
35 typedef struct _GaimPluginUiInfo GaimPluginUiInfo; |
| 5205 | 36 typedef struct _GaimPluginLoaderInfo GaimPluginLoaderInfo; |
| 37 | |
| 9015 | 38 typedef struct _GaimPluginAction GaimPluginAction; |
| 39 | |
| 5205 | 40 typedef int GaimPluginPriority; /**< Plugin priority. */ |
| 41 | |
| 8713 | 42 #include "pluginpref.h" |
| 43 | |
| 5205 | 44 /** |
| 45 * Plugin types. | |
| 46 */ | |
|
5944
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
47 typedef enum |
| 5205 | 48 { |
| 49 GAIM_PLUGIN_UNKNOWN = -1, /**< Unknown type. */ | |
| 50 GAIM_PLUGIN_STANDARD = 0, /**< Standard plugin. */ | |
| 51 GAIM_PLUGIN_LOADER, /**< Loader plugin. */ | |
| 52 GAIM_PLUGIN_PROTOCOL /**< Protocol plugin. */ | |
|
5944
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
53 |
|
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
54 } GaimPluginType; |
| 5205 | 55 |
| 56 #define GAIM_PRIORITY_DEFAULT 0 | |
| 57 #define GAIM_PRIORITY_HIGHEST 9999 | |
| 58 #define GAIM_PRIORITY_LOWEST -9999 | |
| 59 | |
|
6928
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6822
diff
changeset
|
60 #define GAIM_PLUGIN_FLAG_INVISIBLE 0x01 |
|
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6822
diff
changeset
|
61 |
| 9946 | 62 #define GAIM_PLUGIN_MAGIC 5 /* once we hit 6.0.0 I think we can remove this */ |
|
8749
d7b8eb1f0a18
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
63 |
| 5205 | 64 /** |
| 65 * Detailed information about a plugin. | |
| 66 * | |
| 67 * This is used in the version 2.0 API and up. | |
| 68 */ | |
| 69 struct _GaimPluginInfo | |
| 70 { | |
| 9943 | 71 unsigned int magic; |
| 72 unsigned int major_version; | |
| 73 unsigned int minor_version; | |
| 5205 | 74 GaimPluginType type; |
| 75 char *ui_requirement; | |
| 76 unsigned long flags; | |
| 77 GList *dependencies; | |
| 78 GaimPluginPriority priority; | |
| 79 | |
| 80 char *id; | |
| 81 char *name; | |
| 82 char *version; | |
| 83 char *summary; | |
| 84 char *description; | |
| 85 char *author; | |
| 86 char *homepage; | |
| 87 | |
| 10450 | 88 /* |
| 89 * TODO: I think the intention was the allow multiple load and unload | |
| 90 * callback functions. Perhaps using a GList instead of a pointer to | |
| 91 * 1 function. | |
| 92 */ | |
| 5205 | 93 gboolean (*load)(GaimPlugin *plugin); |
| 94 gboolean (*unload)(GaimPlugin *plugin); | |
| 95 void (*destroy)(GaimPlugin *plugin); | |
| 96 | |
| 97 void *ui_info; | |
| 98 void *extra_info; | |
| 8814 | 99 GaimPluginUiInfo *prefs_info; |
| 9015 | 100 GList *(*actions)(GaimPlugin *plugin, gpointer context); |
| 5205 | 101 }; |
| 102 | |
| 103 /** | |
| 104 * Extra information for loader plugins. | |
| 105 */ | |
| 106 struct _GaimPluginLoaderInfo | |
| 107 { | |
| 108 GList *exts; | |
| 109 | |
| 110 gboolean (*probe)(GaimPlugin *plugin); | |
| 111 gboolean (*load)(GaimPlugin *plugin); | |
| 112 gboolean (*unload)(GaimPlugin *plugin); | |
| 113 void (*destroy)(GaimPlugin *plugin); | |
| 114 }; | |
| 115 | |
| 116 /** | |
| 117 * A plugin handle. | |
| 118 */ | |
| 119 struct _GaimPlugin | |
| 120 { | |
| 121 gboolean native_plugin; /**< Native C plugin. */ | |
| 122 gboolean loaded; /**< The loaded state. */ | |
| 123 void *handle; /**< The module handle. */ | |
| 124 char *path; /**< The path to the plugin. */ | |
| 125 GaimPluginInfo *info; /**< The plugin information. */ | |
| 126 char *error; | |
|
6822
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
127 void *ipc_data; /**< IPC data. */ |
| 5205 | 128 void *extra; /**< Plugin-specific data. */ |
| 129 }; | |
| 130 | |
| 131 #define GAIM_PLUGIN_LOADER_INFO(plugin) \ | |
| 132 ((GaimPluginLoaderInfo *)(plugin)->info->extra_info) | |
| 133 | |
| 8713 | 134 struct _GaimPluginUiInfo { |
| 135 GaimPluginPrefFrame *(*get_plugin_pref_frame)(GaimPlugin *plugin); | |
| 136 | |
| 137 void *iter; /**< Reserved */ | |
| 8814 | 138 GaimPluginPrefFrame *frame; /**< Reserved */ |
| 8713 | 139 }; |
| 140 | |
| 141 #define GAIM_PLUGIN_HAS_PREF_FRAME(plugin) \ | |
| 142 ((plugin)->info != NULL && (plugin)->info->prefs_info != NULL) | |
| 143 | |
| 144 #define GAIM_PLUGIN_UI_INFO(plugin) \ | |
| 145 ((GaimPluginUiInfo*)(plugin)->info->prefs_info) | |
| 146 | |
| 9015 | 147 |
| 148 /** | |
| 149 * The structure used in the actions member of GaimPluginInfo | |
| 150 */ | |
| 151 struct _GaimPluginAction { | |
| 152 char *label; | |
| 153 void (*callback)(GaimPluginAction *); | |
| 154 | |
| 155 /** set to the owning plugin */ | |
| 156 GaimPlugin *plugin; | |
| 157 | |
| 158 /** NULL for plugin actions menu, set to the GaimConnection for | |
| 159 account actions menu */ | |
| 160 gpointer context; | |
| 161 }; | |
| 162 | |
| 163 #define GAIM_PLUGIN_HAS_ACTIONS(plugin) \ | |
| 164 ((plugin)->info != NULL && (plugin)->info->actions != NULL) | |
| 165 | |
| 166 #define GAIM_PLUGIN_ACTIONS(plugin, context) \ | |
| 167 (GAIM_PLUGIN_HAS_ACTIONS(plugin)? \ | |
| 168 (plugin)->info->actions(plugin, context): NULL) | |
| 169 | |
| 170 | |
| 5205 | 171 /** |
| 172 * Handles the initialization of modules. | |
| 173 */ | |
| 8082 | 174 #if !defined(GAIM_PLUGINS) || defined(GAIM_STATIC_PRPL) |
| 5205 | 175 # define GAIM_INIT_PLUGIN(pluginname, initfunc, plugininfo) \ |
| 176 gboolean gaim_init_##pluginname##_plugin(void) { \ | |
| 177 GaimPlugin *plugin = gaim_plugin_new(TRUE, NULL); \ | |
| 178 plugin->info = &(plugininfo); \ | |
| 179 initfunc((plugin)); \ | |
| 180 return gaim_plugin_register(plugin); \ | |
| 181 } | |
| 8082 | 182 #else /* GAIM_PLUGINS && !GAIM_STATIC_PRPL */ |
| 5205 | 183 # define GAIM_INIT_PLUGIN(pluginname, initfunc, plugininfo) \ |
|
5224
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5205
diff
changeset
|
184 G_MODULE_EXPORT gboolean gaim_init_plugin(GaimPlugin *plugin) { \ |
| 5205 | 185 plugin->info = &(plugininfo); \ |
| 186 initfunc((plugin)); \ | |
| 187 return gaim_plugin_register(plugin); \ | |
| 188 } | |
| 189 #endif | |
| 190 | |
| 9015 | 191 |
|
5944
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
192 #ifdef __cplusplus |
|
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
193 extern "C" { |
|
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
194 #endif |
|
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
195 |
| 5205 | 196 /**************************************************************************/ |
|
5944
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
197 /** @name Plugin API */ |
| 5205 | 198 /**************************************************************************/ |
| 199 /*@{*/ | |
| 200 | |
| 201 /** | |
| 202 * Creates a new plugin structure. | |
| 203 * | |
| 204 * @param native Whether or not the plugin is native. | |
| 205 * @param path The path to the plugin, or @c NULL if statically compiled. | |
| 206 * | |
| 207 * @return A new GaimPlugin structure. | |
| 208 */ | |
| 209 GaimPlugin *gaim_plugin_new(gboolean native, const char *path); | |
| 210 | |
| 211 /** | |
| 212 * Probes a plugin, retrieving the information on it and adding it to the | |
| 213 * list of available plugins. | |
| 214 * | |
| 215 * @param filename The plugin's filename. | |
| 216 * | |
| 217 * @return The plugin handle. | |
| 218 * | |
| 219 * @see gaim_plugin_load() | |
| 220 * @see gaim_plugin_destroy() | |
| 221 */ | |
| 222 GaimPlugin *gaim_plugin_probe(const char *filename); | |
| 223 | |
| 224 /** | |
| 225 * Registers a plugin and prepares it for loading. | |
| 226 * | |
| 227 * This shouldn't be called by anything but the internal module code. | |
| 10447 | 228 * Plugins should use the GAIM_INIT_PLUGIN() macro to register themselves |
| 229 * with the core. | |
| 5205 | 230 * |
| 231 * @param plugin The plugin to register. | |
| 10447 | 232 * |
| 233 * @return @c TRUE if the plugin was registered successfully. Otherwise | |
| 234 * @c FALSE is returned (this happens if the plugin does not contain | |
| 235 * the necessary information). | |
| 5205 | 236 */ |
| 237 gboolean gaim_plugin_register(GaimPlugin *plugin); | |
| 238 | |
| 239 /** | |
| 240 * Attempts to load a previously probed plugin. | |
| 241 * | |
|
6720
41120df7ed94
[gaim-migrate @ 7247]
Christian Hammond <chipx86@chipx86.com>
parents:
6486
diff
changeset
|
242 * @param plugin The plugin to load. |
| 5205 | 243 * |
| 244 * @return @c TRUE if successful, or @c FALSE otherwise. | |
| 245 * | |
| 246 * @see gaim_plugin_reload() | |
| 247 * @see gaim_plugin_unload() | |
| 248 */ | |
| 249 gboolean gaim_plugin_load(GaimPlugin *plugin); | |
| 250 | |
| 251 /** | |
| 252 * Unloads the specified plugin. | |
| 253 * | |
| 254 * @param plugin The plugin handle. | |
| 255 * | |
| 256 * @return @c TRUE if successful, or @c FALSE otherwise. | |
| 257 * | |
| 258 * @see gaim_plugin_load() | |
| 259 * @see gaim_plugin_reload() | |
| 260 */ | |
| 261 gboolean gaim_plugin_unload(GaimPlugin *plugin); | |
| 262 | |
| 263 /** | |
| 264 * Reloads a plugin. | |
| 265 * | |
| 266 * @param plugin The old plugin handle. | |
|
6486
fab81e4b885c
[gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
267 * |
| 5205 | 268 * @return @c TRUE if successful, or @c FALSE otherwise. |
| 269 * | |
| 270 * @see gaim_plugin_load() | |
| 271 * @see gaim_plugin_unload() | |
| 272 */ | |
| 273 gboolean gaim_plugin_reload(GaimPlugin *plugin); | |
| 274 | |
| 275 /** | |
| 276 * Unloads a plugin and destroys the structure from memory. | |
| 277 * | |
| 278 * @param plugin The plugin handle. | |
| 279 */ | |
| 280 void gaim_plugin_destroy(GaimPlugin *plugin); | |
| 281 | |
| 282 /** | |
| 283 * Returns whether or not a plugin is currently loaded. | |
| 284 * | |
| 285 * @param plugin The plugin. | |
| 286 * | |
| 287 * @return TRUE if loaded, or FALSE otherwise. | |
| 288 */ | |
| 289 gboolean gaim_plugin_is_loaded(const GaimPlugin *plugin); | |
| 290 | |
| 291 /*@}*/ | |
| 292 | |
| 293 /**************************************************************************/ | |
|
6822
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
294 /** @name Plugin IPC API */ |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
295 /**************************************************************************/ |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
296 /*@{*/ |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
297 |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
298 /** |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
299 * Registers an IPC command in a plugin. |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
300 * |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
301 * @param plugin The plugin to register the command with. |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
302 * @param command The name of the command. |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
303 * @param func The function to execute. |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
304 * @param marshal The marshalling function. |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
305 * @param ret_value The return value type. |
|
7114
c47633e9e2a4
[gaim-migrate @ 7681]
Christian Hammond <chipx86@chipx86.com>
parents:
7034
diff
changeset
|
306 * @param num_params The number of parameters. |
|
6822
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
307 * @param ... The parameter types. |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
308 * |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
309 * @return TRUE if the function was registered successfully, or |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
310 * FALSE otherwise. |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
311 */ |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
312 gboolean gaim_plugin_ipc_register(GaimPlugin *plugin, const char *command, |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
313 GaimCallback func, |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
314 GaimSignalMarshalFunc marshal, |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
315 GaimValue *ret_value, int num_params, ...); |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
316 |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
317 /** |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
318 * Unregisters an IPC command in a plugin. |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
319 * |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
320 * @param plugin The plugin to unregister the command from. |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
321 * @param command The name of the command. |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
322 */ |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
323 void gaim_plugin_ipc_unregister(GaimPlugin *plugin, const char *command); |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
324 |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
325 /** |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
326 * Unregisters all IPC commands in a plugin. |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
327 * |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
328 * @param plugin The plugin to unregister the commands from. |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
329 */ |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
330 void gaim_plugin_ipc_unregister_all(GaimPlugin *plugin); |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
331 |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
332 /** |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
333 * Returns a list of value types used for an IPC command. |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
334 * |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
335 * @param plugin The plugin. |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
336 * @param command The name of the command. |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
337 * @param ret_value The returned return value. |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
338 * @param num_params The returned number of parameters. |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
339 * @param params The returned list of parameters. |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
340 * |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
341 * @return TRUE if the command was found, or FALSE otherwise. |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
342 */ |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
343 gboolean gaim_plugin_ipc_get_params(GaimPlugin *plugin, const char *command, |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
344 GaimValue **ret_value, int *num_params, |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
345 GaimValue ***params); |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
346 |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
347 /** |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
348 * Executes an IPC command. |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
349 * |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
350 * @param plugin The plugin to execute the command on. |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
351 * @param command The name of the command. |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
352 * @param ok TRUE if the call was successful, or FALSE otherwise. |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
353 * @param ... The parameters to pass. |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
354 * |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
355 * @return The return value, which will be NULL if the command doesn't |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
356 * return a value. |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
357 */ |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
358 void *gaim_plugin_ipc_call(GaimPlugin *plugin, const char *command, |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
359 gboolean *ok, ...); |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
360 |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
361 /*@}*/ |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
362 |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
363 /**************************************************************************/ |
|
5944
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
364 /** @name Plugins API */ |
| 5205 | 365 /**************************************************************************/ |
| 366 /*@{*/ | |
| 367 | |
| 368 /** | |
| 10447 | 369 * Add a new directory to search for plugins |
| 5205 | 370 * |
| 10448 | 371 * @param path The new search path. |
| 5205 | 372 */ |
| 10447 | 373 void gaim_plugins_add_search_path(const char *path); |
| 5205 | 374 |
| 375 /** | |
|
5242
fd81a00480ac
[gaim-migrate @ 5613]
Christian Hammond <chipx86@chipx86.com>
parents:
5224
diff
changeset
|
376 * Unloads all loaded plugins. |
| 5205 | 377 */ |
| 378 void gaim_plugins_unload_all(void); | |
| 379 | |
|
5242
fd81a00480ac
[gaim-migrate @ 5613]
Christian Hammond <chipx86@chipx86.com>
parents:
5224
diff
changeset
|
380 /** |
|
fd81a00480ac
[gaim-migrate @ 5613]
Christian Hammond <chipx86@chipx86.com>
parents:
5224
diff
changeset
|
381 * Destroys all registered plugins. |
|
fd81a00480ac
[gaim-migrate @ 5613]
Christian Hammond <chipx86@chipx86.com>
parents:
5224
diff
changeset
|
382 */ |
|
fd81a00480ac
[gaim-migrate @ 5613]
Christian Hammond <chipx86@chipx86.com>
parents:
5224
diff
changeset
|
383 void gaim_plugins_destroy_all(void); |
|
fd81a00480ac
[gaim-migrate @ 5613]
Christian Hammond <chipx86@chipx86.com>
parents:
5224
diff
changeset
|
384 |
| 5205 | 385 /** |
|
5949
90d0849abd3c
[gaim-migrate @ 6393]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
386 * Attempts to load all the plugins in the specified preference key |
|
90d0849abd3c
[gaim-migrate @ 6393]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
387 * that were loaded when gaim last quit. |
|
90d0849abd3c
[gaim-migrate @ 6393]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
388 * |
|
90d0849abd3c
[gaim-migrate @ 6393]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
389 * @param key The preference key containing the list of plugins. |
| 5838 | 390 */ |
|
5949
90d0849abd3c
[gaim-migrate @ 6393]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
391 void gaim_plugins_load_saved(const char *key); |
| 5838 | 392 |
| 393 /** | |
| 5205 | 394 * Probes for plugins in the registered module paths. |
| 395 * | |
| 396 * @param ext The extension type to probe for, or @c NULL for all. | |
| 397 * | |
| 398 * @see gaim_plugin_set_probe_path() | |
| 399 */ | |
| 400 void gaim_plugins_probe(const char *ext); | |
| 401 | |
| 402 /** | |
| 403 * Returns whether or not plugin support is enabled. | |
| 404 * | |
| 405 * @return TRUE if plugin support is enabled, or FALSE otherwise. | |
| 406 */ | |
| 407 gboolean gaim_plugins_enabled(void); | |
| 408 | |
| 409 /** | |
| 410 * Registers a function that will be called when probing is finished. | |
| 411 * | |
| 412 * @param func The callback function. | |
| 413 * @param data Data to pass to the callback. | |
| 414 */ | |
| 415 void gaim_plugins_register_probe_notify_cb(void (*func)(void *), void *data); | |
| 416 | |
| 417 /** | |
| 418 * Unregisters a function that would be called when probing is finished. | |
| 419 * | |
| 420 * @param func The callback function. | |
| 421 */ | |
| 422 void gaim_plugins_unregister_probe_notify_cb(void (*func)(void *)); | |
| 423 | |
| 424 /** | |
| 425 * Registers a function that will be called when a plugin is loaded. | |
| 426 * | |
|
8735
92cbf9713795
[gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents:
8713
diff
changeset
|
427 * @param func The callback function. |
| 5205 | 428 * @param data Data to pass to the callback. |
| 429 */ | |
| 430 void gaim_plugins_register_load_notify_cb(void (*func)(GaimPlugin *, void *), | |
| 431 void *data); | |
| 432 | |
| 433 /** | |
| 434 * Unregisters a function that would be called when a plugin is loaded. | |
| 435 * | |
|
8735
92cbf9713795
[gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents:
8713
diff
changeset
|
436 * @param func The callback function. |
| 5205 | 437 */ |
| 438 void gaim_plugins_unregister_load_notify_cb(void (*func)(GaimPlugin *, void *)); | |
| 439 | |
| 440 /** | |
| 441 * Registers a function that will be called when a plugin is unloaded. | |
| 442 * | |
|
8735
92cbf9713795
[gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents:
8713
diff
changeset
|
443 * @param func The callback function. |
| 5205 | 444 * @param data Data to pass to the callback. |
| 445 */ | |
| 446 void gaim_plugins_register_unload_notify_cb(void (*func)(GaimPlugin *, void *), | |
| 447 void *data); | |
| 448 | |
| 449 /** | |
| 450 * Unregisters a function that would be called when a plugin is unloaded. | |
| 451 * | |
|
8735
92cbf9713795
[gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents:
8713
diff
changeset
|
452 * @param func The callback function. |
| 5205 | 453 */ |
| 454 void gaim_plugins_unregister_unload_notify_cb(void (*func)(GaimPlugin *, | |
| 455 void *)); | |
| 456 | |
| 457 /** | |
| 458 * Finds a plugin with the specified name. | |
| 459 * | |
| 460 * @param name The plugin name. | |
| 461 * | |
| 462 * @return The plugin if found, or @c NULL if not found. | |
| 463 */ | |
| 464 GaimPlugin *gaim_plugins_find_with_name(const char *name); | |
| 465 | |
| 466 /** | |
|
7034
f7ff0dfa6b9f
[gaim-migrate @ 7597]
Christian Hammond <chipx86@chipx86.com>
parents:
7033
diff
changeset
|
467 * Finds a plugin with the specified filename (filename with a path). |
| 5205 | 468 * |
| 469 * @param filename The plugin filename. | |
| 470 * | |
| 471 * @return The plugin if found, or @c NULL if not found. | |
| 472 */ | |
| 473 GaimPlugin *gaim_plugins_find_with_filename(const char *filename); | |
| 474 | |
| 475 /** | |
|
7034
f7ff0dfa6b9f
[gaim-migrate @ 7597]
Christian Hammond <chipx86@chipx86.com>
parents:
7033
diff
changeset
|
476 * Finds a plugin with the specified basename (filename without a path). |
|
7033
cf1126ba1834
[gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents:
6928
diff
changeset
|
477 * |
|
7034
f7ff0dfa6b9f
[gaim-migrate @ 7597]
Christian Hammond <chipx86@chipx86.com>
parents:
7033
diff
changeset
|
478 * @param basename The plugin basename. |
|
7033
cf1126ba1834
[gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents:
6928
diff
changeset
|
479 * |
|
cf1126ba1834
[gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents:
6928
diff
changeset
|
480 * @return The plugin if found, or @c NULL if not found. |
|
cf1126ba1834
[gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents:
6928
diff
changeset
|
481 */ |
|
cf1126ba1834
[gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents:
6928
diff
changeset
|
482 GaimPlugin *gaim_plugins_find_with_basename(const char *basename); |
|
cf1126ba1834
[gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents:
6928
diff
changeset
|
483 |
|
cf1126ba1834
[gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents:
6928
diff
changeset
|
484 /** |
| 5205 | 485 * Finds a plugin with the specified plugin ID. |
| 486 * | |
| 487 * @param id The plugin ID. | |
| 488 * | |
| 489 * @return The plugin if found, or @c NULL if not found. | |
| 490 */ | |
| 491 GaimPlugin *gaim_plugins_find_with_id(const char *id); | |
| 492 | |
| 493 /** | |
| 494 * Returns a list of all loaded plugins. | |
| 495 * | |
|
5573
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5449
diff
changeset
|
496 * @return A list of all loaded plugins. |
| 5205 | 497 */ |
| 498 GList *gaim_plugins_get_loaded(void); | |
| 499 | |
| 500 /** | |
|
5573
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5449
diff
changeset
|
501 * Returns a list of all protocol plugins. |
|
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5449
diff
changeset
|
502 * |
|
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5449
diff
changeset
|
503 * @return A list of all protocol plugins. |
|
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5449
diff
changeset
|
504 */ |
|
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5449
diff
changeset
|
505 GList *gaim_plugins_get_protocols(void); |
|
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5449
diff
changeset
|
506 |
|
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5449
diff
changeset
|
507 /** |
| 5205 | 508 * Returns a list of all plugins, whether loaded or not. |
| 509 * | |
| 510 * @return A list of all plugins. | |
| 511 */ | |
| 512 GList *gaim_plugins_get_all(void); | |
| 513 | |
| 514 /*@}*/ | |
| 515 | |
| 10479 | 516 /**************************************************************************/ |
| 517 /** @name Plugins SubSytem API */ | |
| 518 /**************************************************************************/ | |
| 519 /*@{*/ | |
| 520 | |
| 521 /** | |
| 522 * Returns the plugin subsystem handle. | |
| 523 * | |
| 524 * @return The plugin sybsystem handle. | |
| 525 */ | |
| 526 void *gaim_plugins_get_handle(void); | |
| 527 | |
| 528 /** | |
| 529 * Initializes the plugin subsystem | |
| 530 */ | |
| 531 void gaim_plugins_init(void); | |
| 532 | |
| 533 /** | |
| 534 * Uninitializes the plugin subsystem | |
| 535 */ | |
| 536 void gaim_plugins_uninit(void); | |
| 537 | |
| 538 /*@}*/ | |
| 9015 | 539 |
| 540 /** | |
| 541 * Allocates and returns a new GaimPluginAction. | |
| 542 */ | |
| 543 GaimPluginAction *gaim_plugin_action_new(char* label, void (*callback)(GaimPluginAction *)); | |
| 544 | |
|
5944
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
545 #ifdef __cplusplus |
|
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
546 } |
|
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
547 #endif |
|
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
548 |
| 5205 | 549 #endif /* _GAIM_PLUGIN_H_ */ |
