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