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