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