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