Mercurial > pidgin
annotate src/plugin.h @ 8749:d7b8eb1f0a18
[gaim-migrate @ 9504]
Bumped up the plugin API version number, and added version numbers for
loader plugins and protocol plugins. Authors will want to update their
plugins, and possibly use GAIM_PLUGIN_API_VERSION, GAIM_PRPL_API_VERSION,
and GAIM_LOADER_API_VERSION constants.
committer: Tailor Script <tailor@pidgin.im>
| author | Christian Hammond <chipx86@chipx86.com> |
|---|---|
| date | Thu, 22 Apr 2004 01:53:18 +0000 |
| parents | 92cbf9713795 |
| children | c61be128dff3 |
| 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 |
|
5224
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5205
diff
changeset
|
28 #include <gmodule.h> |
|
6822
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
29 #include "signals.h" |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
30 #include "value.h" |
| 5205 | 31 |
|
8749
d7b8eb1f0a18
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
32 typedef struct _GaimPlugin GaimPlugin; |
|
d7b8eb1f0a18
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
33 typedef struct _GaimPluginInfo GaimPluginInfo; |
|
d7b8eb1f0a18
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
34 typedef struct _GaimPluginUiInfo GaimPluginUiInfo; |
| 5205 | 35 typedef struct _GaimPluginLoaderInfo GaimPluginLoaderInfo; |
| 36 | |
| 37 typedef int GaimPluginPriority; /**< Plugin priority. */ | |
| 38 | |
| 8713 | 39 #include "pluginpref.h" |
| 40 | |
| 5205 | 41 /** |
| 42 * Plugin types. | |
| 43 */ | |
|
5944
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
44 typedef enum |
| 5205 | 45 { |
| 46 GAIM_PLUGIN_UNKNOWN = -1, /**< Unknown type. */ | |
| 47 GAIM_PLUGIN_STANDARD = 0, /**< Standard plugin. */ | |
| 48 GAIM_PLUGIN_LOADER, /**< Loader plugin. */ | |
| 49 GAIM_PLUGIN_PROTOCOL /**< Protocol plugin. */ | |
|
5944
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
50 |
|
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
51 } GaimPluginType; |
| 5205 | 52 |
| 53 #define GAIM_PRIORITY_DEFAULT 0 | |
| 54 #define GAIM_PRIORITY_HIGHEST 9999 | |
| 55 #define GAIM_PRIORITY_LOWEST -9999 | |
| 56 | |
|
6928
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6822
diff
changeset
|
57 #define GAIM_PLUGIN_FLAG_INVISIBLE 0x01 |
|
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6822
diff
changeset
|
58 |
|
8749
d7b8eb1f0a18
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
59 #define GAIM_PLUGIN_API_VERSION 3 |
|
d7b8eb1f0a18
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
60 #define GAIM_LOADER_API_VERSION 2 |
|
d7b8eb1f0a18
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
61 |
| 5205 | 62 /** |
| 63 * Detailed information about a plugin. | |
| 64 * | |
| 65 * This is used in the version 2.0 API and up. | |
| 66 */ | |
| 67 struct _GaimPluginInfo | |
| 68 { | |
| 69 unsigned int api_version; | |
| 70 GaimPluginType type; | |
| 71 char *ui_requirement; | |
| 72 unsigned long flags; | |
| 73 GList *dependencies; | |
| 74 GaimPluginPriority priority; | |
| 75 | |
| 76 char *id; | |
| 77 char *name; | |
| 78 char *version; | |
| 79 char *summary; | |
| 80 char *description; | |
| 81 char *author; | |
| 82 char *homepage; | |
| 83 | |
| 84 gboolean (*load)(GaimPlugin *plugin); | |
| 85 gboolean (*unload)(GaimPlugin *plugin); | |
| 86 void (*destroy)(GaimPlugin *plugin); | |
| 87 | |
| 88 void *ui_info; | |
| 89 void *extra_info; | |
| 8713 | 90 void *prefs_info; |
| 5205 | 91 }; |
| 92 | |
| 93 /** | |
| 94 * Extra information for loader plugins. | |
| 95 */ | |
| 96 struct _GaimPluginLoaderInfo | |
| 97 { | |
|
8749
d7b8eb1f0a18
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
98 unsigned int api_version; |
|
d7b8eb1f0a18
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
99 |
| 5205 | 100 GList *exts; |
| 101 | |
| 102 gboolean (*probe)(GaimPlugin *plugin); | |
| 103 gboolean (*load)(GaimPlugin *plugin); | |
| 104 gboolean (*unload)(GaimPlugin *plugin); | |
| 105 void (*destroy)(GaimPlugin *plugin); | |
| 106 }; | |
| 107 | |
| 108 /** | |
| 109 * A plugin handle. | |
| 110 */ | |
| 111 struct _GaimPlugin | |
| 112 { | |
| 113 gboolean native_plugin; /**< Native C plugin. */ | |
| 114 gboolean loaded; /**< The loaded state. */ | |
| 115 void *handle; /**< The module handle. */ | |
| 116 char *path; /**< The path to the plugin. */ | |
| 117 GaimPluginInfo *info; /**< The plugin information. */ | |
| 118 char *error; | |
|
6822
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
119 void *ipc_data; /**< IPC data. */ |
| 5205 | 120 void *extra; /**< Plugin-specific data. */ |
| 121 }; | |
| 122 | |
| 123 #define GAIM_PLUGIN_LOADER_INFO(plugin) \ | |
| 124 ((GaimPluginLoaderInfo *)(plugin)->info->extra_info) | |
| 125 | |
| 8713 | 126 struct _GaimPluginUiInfo { |
| 127 GaimPluginPrefFrame *(*get_plugin_pref_frame)(GaimPlugin *plugin); | |
| 128 | |
| 129 void *iter; /**< Reserved */ | |
| 130 }; | |
| 131 | |
| 132 #define GAIM_PLUGIN_HAS_PREF_FRAME(plugin) \ | |
| 133 ((plugin)->info != NULL && (plugin)->info->prefs_info != NULL) | |
| 134 | |
| 135 #define GAIM_PLUGIN_UI_INFO(plugin) \ | |
| 136 ((GaimPluginUiInfo*)(plugin)->info->prefs_info) | |
| 137 | |
| 5205 | 138 /** |
| 139 * Handles the initialization of modules. | |
| 140 */ | |
| 8082 | 141 #if !defined(GAIM_PLUGINS) || defined(GAIM_STATIC_PRPL) |
| 5205 | 142 # define GAIM_INIT_PLUGIN(pluginname, initfunc, plugininfo) \ |
| 143 gboolean gaim_init_##pluginname##_plugin(void) { \ | |
| 144 GaimPlugin *plugin = gaim_plugin_new(TRUE, NULL); \ | |
| 145 plugin->info = &(plugininfo); \ | |
| 146 initfunc((plugin)); \ | |
| 147 return gaim_plugin_register(plugin); \ | |
| 148 } | |
| 8082 | 149 #else /* GAIM_PLUGINS && !GAIM_STATIC_PRPL */ |
| 5205 | 150 # define GAIM_INIT_PLUGIN(pluginname, initfunc, plugininfo) \ |
|
5224
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5205
diff
changeset
|
151 G_MODULE_EXPORT gboolean gaim_init_plugin(GaimPlugin *plugin) { \ |
| 5205 | 152 plugin->info = &(plugininfo); \ |
| 153 initfunc((plugin)); \ | |
| 154 return gaim_plugin_register(plugin); \ | |
| 155 } | |
| 156 #endif | |
| 157 | |
|
5944
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
158 #ifdef __cplusplus |
|
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
159 extern "C" { |
|
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
160 #endif |
|
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
161 |
| 5205 | 162 /**************************************************************************/ |
|
5944
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
163 /** @name Plugin API */ |
| 5205 | 164 /**************************************************************************/ |
| 165 /*@{*/ | |
| 166 | |
| 167 /** | |
| 168 * Creates a new plugin structure. | |
| 169 * | |
| 170 * @param native Whether or not the plugin is native. | |
| 171 * @param path The path to the plugin, or @c NULL if statically compiled. | |
| 172 * | |
| 173 * @return A new GaimPlugin structure. | |
| 174 */ | |
| 175 GaimPlugin *gaim_plugin_new(gboolean native, const char *path); | |
| 176 | |
| 177 /** | |
| 178 * Probes a plugin, retrieving the information on it and adding it to the | |
| 179 * list of available plugins. | |
| 180 * | |
| 181 * @param filename The plugin's filename. | |
| 182 * | |
| 183 * @return The plugin handle. | |
| 184 * | |
| 185 * @see gaim_plugin_load() | |
| 186 * @see gaim_plugin_destroy() | |
| 187 */ | |
| 188 GaimPlugin *gaim_plugin_probe(const char *filename); | |
| 189 | |
| 190 /** | |
| 191 * Registers a plugin and prepares it for loading. | |
| 192 * | |
| 193 * This shouldn't be called by anything but the internal module code. | |
| 194 * | |
| 195 * @param plugin The plugin to register. | |
| 196 */ | |
| 197 gboolean gaim_plugin_register(GaimPlugin *plugin); | |
| 198 | |
| 199 /** | |
| 200 * Attempts to load a previously probed plugin. | |
| 201 * | |
|
6720
41120df7ed94
[gaim-migrate @ 7247]
Christian Hammond <chipx86@chipx86.com>
parents:
6486
diff
changeset
|
202 * @param plugin The plugin to load. |
| 5205 | 203 * |
| 204 * @return @c TRUE if successful, or @c FALSE otherwise. | |
| 205 * | |
| 206 * @see gaim_plugin_reload() | |
| 207 * @see gaim_plugin_unload() | |
| 208 */ | |
| 209 gboolean gaim_plugin_load(GaimPlugin *plugin); | |
| 210 | |
| 211 /** | |
| 212 * Unloads the specified plugin. | |
| 213 * | |
| 214 * @param plugin The plugin handle. | |
| 215 * | |
| 216 * @return @c TRUE if successful, or @c FALSE otherwise. | |
| 217 * | |
| 218 * @see gaim_plugin_load() | |
| 219 * @see gaim_plugin_reload() | |
| 220 */ | |
| 221 gboolean gaim_plugin_unload(GaimPlugin *plugin); | |
| 222 | |
| 223 /** | |
| 224 * Reloads a plugin. | |
| 225 * | |
| 226 * @param plugin The old plugin handle. | |
|
6486
fab81e4b885c
[gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
227 * |
| 5205 | 228 * @return @c TRUE if successful, or @c FALSE otherwise. |
| 229 * | |
| 230 * @see gaim_plugin_load() | |
| 231 * @see gaim_plugin_unload() | |
| 232 */ | |
| 233 gboolean gaim_plugin_reload(GaimPlugin *plugin); | |
| 234 | |
| 235 /** | |
| 236 * Unloads a plugin and destroys the structure from memory. | |
| 237 * | |
| 238 * @param plugin The plugin handle. | |
| 239 */ | |
| 240 void gaim_plugin_destroy(GaimPlugin *plugin); | |
| 241 | |
| 242 /** | |
| 243 * Returns whether or not a plugin is currently loaded. | |
| 244 * | |
| 245 * @param plugin The plugin. | |
| 246 * | |
| 247 * @return TRUE if loaded, or FALSE otherwise. | |
| 248 */ | |
| 249 gboolean gaim_plugin_is_loaded(const GaimPlugin *plugin); | |
| 250 | |
| 251 /*@}*/ | |
| 252 | |
| 253 /**************************************************************************/ | |
|
6822
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
254 /** @name Plugin IPC API */ |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
255 /**************************************************************************/ |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
256 /*@{*/ |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
257 |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
258 /** |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
259 * Registers an IPC command in a plugin. |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
260 * |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
261 * @param plugin The plugin to register the command with. |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
262 * @param command The name of the command. |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
263 * @param func The function to execute. |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
264 * @param marshal The marshalling function. |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
265 * @param ret_value The return value type. |
|
7114
c47633e9e2a4
[gaim-migrate @ 7681]
Christian Hammond <chipx86@chipx86.com>
parents:
7034
diff
changeset
|
266 * @param num_params The number of parameters. |
|
6822
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
267 * @param ... The parameter types. |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
268 * |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
269 * @return TRUE if the function was registered successfully, or |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
270 * FALSE otherwise. |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
271 */ |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
272 gboolean gaim_plugin_ipc_register(GaimPlugin *plugin, const char *command, |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
273 GaimCallback func, |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
274 GaimSignalMarshalFunc marshal, |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
275 GaimValue *ret_value, int num_params, ...); |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
276 |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
277 /** |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
278 * Unregisters an IPC command in a plugin. |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
279 * |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
280 * @param plugin The plugin to unregister the command from. |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
281 * @param command The name of the command. |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
282 */ |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
283 void gaim_plugin_ipc_unregister(GaimPlugin *plugin, const char *command); |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
284 |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
285 /** |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
286 * Unregisters all IPC commands in a plugin. |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
287 * |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
288 * @param plugin The plugin to unregister the commands from. |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
289 */ |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
290 void gaim_plugin_ipc_unregister_all(GaimPlugin *plugin); |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
291 |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
292 /** |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
293 * Returns a list of value types used for an IPC command. |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
294 * |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
295 * @param plugin The plugin. |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
296 * @param command The name of the command. |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
297 * @param ret_value The returned return value. |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
298 * @param num_params The returned number of parameters. |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
299 * @param params The returned list of parameters. |
|
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 * @return TRUE if the command was found, or FALSE otherwise. |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
302 */ |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
303 gboolean gaim_plugin_ipc_get_params(GaimPlugin *plugin, const char *command, |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
304 GaimValue **ret_value, int *num_params, |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
305 GaimValue ***params); |
|
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 * Executes an IPC command. |
|
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 * @param plugin The plugin to execute the command on. |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
311 * @param command The name of the command. |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
312 * @param ok TRUE if the call was successful, or FALSE otherwise. |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
313 * @param ... The parameters to pass. |
|
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 * @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
|
316 * return a value. |
|
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 void *gaim_plugin_ipc_call(GaimPlugin *plugin, const char *command, |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
319 gboolean *ok, ...); |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
320 |
|
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 |
|
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
323 /**************************************************************************/ |
|
5944
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
324 /** @name Plugins API */ |
| 5205 | 325 /**************************************************************************/ |
| 326 /*@{*/ | |
| 327 | |
| 328 /** | |
| 329 * Sets the search paths for plugins. | |
| 330 * | |
| 331 * @param count The number of search paths. | |
| 332 * @param paths The search paths. | |
| 333 */ | |
| 334 void gaim_plugins_set_search_paths(size_t count, char **paths); | |
| 335 | |
| 336 /** | |
|
5242
fd81a00480ac
[gaim-migrate @ 5613]
Christian Hammond <chipx86@chipx86.com>
parents:
5224
diff
changeset
|
337 * Unloads all loaded plugins. |
| 5205 | 338 */ |
| 339 void gaim_plugins_unload_all(void); | |
| 340 | |
|
5242
fd81a00480ac
[gaim-migrate @ 5613]
Christian Hammond <chipx86@chipx86.com>
parents:
5224
diff
changeset
|
341 /** |
|
fd81a00480ac
[gaim-migrate @ 5613]
Christian Hammond <chipx86@chipx86.com>
parents:
5224
diff
changeset
|
342 * Destroys all registered plugins. |
|
fd81a00480ac
[gaim-migrate @ 5613]
Christian Hammond <chipx86@chipx86.com>
parents:
5224
diff
changeset
|
343 */ |
|
fd81a00480ac
[gaim-migrate @ 5613]
Christian Hammond <chipx86@chipx86.com>
parents:
5224
diff
changeset
|
344 void gaim_plugins_destroy_all(void); |
|
fd81a00480ac
[gaim-migrate @ 5613]
Christian Hammond <chipx86@chipx86.com>
parents:
5224
diff
changeset
|
345 |
| 5205 | 346 /** |
|
5949
90d0849abd3c
[gaim-migrate @ 6393]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
347 * Attempts to load all the plugins in the specified preference key |
|
90d0849abd3c
[gaim-migrate @ 6393]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
348 * that were loaded when gaim last quit. |
|
90d0849abd3c
[gaim-migrate @ 6393]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
349 * |
|
90d0849abd3c
[gaim-migrate @ 6393]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
350 * @param key The preference key containing the list of plugins. |
| 5838 | 351 */ |
|
5949
90d0849abd3c
[gaim-migrate @ 6393]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
352 void gaim_plugins_load_saved(const char *key); |
| 5838 | 353 |
| 354 /** | |
| 5205 | 355 * Probes for plugins in the registered module paths. |
| 356 * | |
| 357 * @param ext The extension type to probe for, or @c NULL for all. | |
| 358 * | |
| 359 * @see gaim_plugin_set_probe_path() | |
| 360 */ | |
| 361 void gaim_plugins_probe(const char *ext); | |
| 362 | |
| 363 /** | |
| 364 * Returns whether or not plugin support is enabled. | |
| 365 * | |
| 366 * @return TRUE if plugin support is enabled, or FALSE otherwise. | |
| 367 */ | |
| 368 gboolean gaim_plugins_enabled(void); | |
| 369 | |
| 370 /** | |
| 371 * Registers a function that will be called when probing is finished. | |
| 372 * | |
| 373 * @param func The callback function. | |
| 374 * @param data Data to pass to the callback. | |
| 375 */ | |
| 376 void gaim_plugins_register_probe_notify_cb(void (*func)(void *), void *data); | |
| 377 | |
| 378 /** | |
| 379 * Unregisters a function that would be called when probing is finished. | |
| 380 * | |
| 381 * @param func The callback function. | |
| 382 */ | |
| 383 void gaim_plugins_unregister_probe_notify_cb(void (*func)(void *)); | |
| 384 | |
| 385 /** | |
| 386 * Registers a function that will be called when a plugin is loaded. | |
| 387 * | |
|
8735
92cbf9713795
[gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents:
8713
diff
changeset
|
388 * @param func The callback function. |
| 5205 | 389 * @param data Data to pass to the callback. |
| 390 */ | |
| 391 void gaim_plugins_register_load_notify_cb(void (*func)(GaimPlugin *, void *), | |
| 392 void *data); | |
| 393 | |
| 394 /** | |
| 395 * Unregisters a function that would be called when a plugin is loaded. | |
| 396 * | |
|
8735
92cbf9713795
[gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents:
8713
diff
changeset
|
397 * @param func The callback function. |
| 5205 | 398 */ |
| 399 void gaim_plugins_unregister_load_notify_cb(void (*func)(GaimPlugin *, void *)); | |
| 400 | |
| 401 /** | |
| 402 * Registers a function that will be called when a plugin is unloaded. | |
| 403 * | |
|
8735
92cbf9713795
[gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents:
8713
diff
changeset
|
404 * @param func The callback function. |
| 5205 | 405 * @param data Data to pass to the callback. |
| 406 */ | |
| 407 void gaim_plugins_register_unload_notify_cb(void (*func)(GaimPlugin *, void *), | |
| 408 void *data); | |
| 409 | |
| 410 /** | |
| 411 * Unregisters a function that would be called when a plugin is unloaded. | |
| 412 * | |
|
8735
92cbf9713795
[gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents:
8713
diff
changeset
|
413 * @param func The callback function. |
| 5205 | 414 */ |
| 415 void gaim_plugins_unregister_unload_notify_cb(void (*func)(GaimPlugin *, | |
| 416 void *)); | |
| 417 | |
| 418 /** | |
| 419 * Finds a plugin with the specified name. | |
| 420 * | |
| 421 * @param name The plugin name. | |
| 422 * | |
| 423 * @return The plugin if found, or @c NULL if not found. | |
| 424 */ | |
| 425 GaimPlugin *gaim_plugins_find_with_name(const char *name); | |
| 426 | |
| 427 /** | |
|
7034
f7ff0dfa6b9f
[gaim-migrate @ 7597]
Christian Hammond <chipx86@chipx86.com>
parents:
7033
diff
changeset
|
428 * Finds a plugin with the specified filename (filename with a path). |
| 5205 | 429 * |
| 430 * @param filename The plugin filename. | |
| 431 * | |
| 432 * @return The plugin if found, or @c NULL if not found. | |
| 433 */ | |
| 434 GaimPlugin *gaim_plugins_find_with_filename(const char *filename); | |
| 435 | |
| 436 /** | |
|
7034
f7ff0dfa6b9f
[gaim-migrate @ 7597]
Christian Hammond <chipx86@chipx86.com>
parents:
7033
diff
changeset
|
437 * 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
|
438 * |
|
7034
f7ff0dfa6b9f
[gaim-migrate @ 7597]
Christian Hammond <chipx86@chipx86.com>
parents:
7033
diff
changeset
|
439 * @param basename The plugin basename. |
|
7033
cf1126ba1834
[gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents:
6928
diff
changeset
|
440 * |
|
cf1126ba1834
[gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents:
6928
diff
changeset
|
441 * @return The plugin if found, or @c NULL if not found. |
|
cf1126ba1834
[gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents:
6928
diff
changeset
|
442 */ |
|
cf1126ba1834
[gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents:
6928
diff
changeset
|
443 GaimPlugin *gaim_plugins_find_with_basename(const char *basename); |
|
cf1126ba1834
[gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents:
6928
diff
changeset
|
444 |
|
cf1126ba1834
[gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents:
6928
diff
changeset
|
445 /** |
| 5205 | 446 * Finds a plugin with the specified plugin ID. |
| 447 * | |
| 448 * @param id The plugin ID. | |
| 449 * | |
| 450 * @return The plugin if found, or @c NULL if not found. | |
| 451 */ | |
| 452 GaimPlugin *gaim_plugins_find_with_id(const char *id); | |
| 453 | |
| 454 /** | |
| 455 * Returns a list of all loaded plugins. | |
| 456 * | |
|
5573
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5449
diff
changeset
|
457 * @return A list of all loaded plugins. |
| 5205 | 458 */ |
| 459 GList *gaim_plugins_get_loaded(void); | |
| 460 | |
| 461 /** | |
|
5573
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5449
diff
changeset
|
462 * Returns a list of all protocol plugins. |
|
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5449
diff
changeset
|
463 * |
|
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5449
diff
changeset
|
464 * @return A list of all protocol plugins. |
|
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5449
diff
changeset
|
465 */ |
|
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5449
diff
changeset
|
466 GList *gaim_plugins_get_protocols(void); |
|
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5449
diff
changeset
|
467 |
|
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5449
diff
changeset
|
468 /** |
| 5205 | 469 * Returns a list of all plugins, whether loaded or not. |
| 470 * | |
| 471 * @return A list of all plugins. | |
| 472 */ | |
| 473 GList *gaim_plugins_get_all(void); | |
| 474 | |
| 475 /*@}*/ | |
| 476 | |
|
5944
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
477 #ifdef __cplusplus |
|
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
478 } |
|
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
479 #endif |
|
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
480 |
| 5205 | 481 #endif /* _GAIM_PLUGIN_H_ */ |
