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