Mercurial > pidgin
annotate src/plugin.h @ 6877:1b5b0cea6915
[gaim-migrate @ 7423]
Fixed an assertion warning for buddy icons on every conversation without a
buddy icon.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Wed, 17 Sep 2003 06:46:36 +0000 |
parents | 7dba3e17cb21 |
children | 6ed0a1c045b4 |
rev | line source |
---|---|
5205 | 1 /** |
2 * @file plugin.h Plugin API | |
3 * @ingroup core | |
4 * | |
5 * gaim | |
6 * | |
7 * Copyright (C) 2003 Christian Hammond <chipx86@gnupdate.org> | |
6485
70d5122bc3ff
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
5949
diff
changeset
|
8 * |
5205 | 9 * This program is free software; you can redistribute it and/or modify |
10 * it under the terms of the GNU General Public License as published by | |
11 * the Free Software Foundation; either version 2 of the License, or | |
12 * (at your option) any later version. | |
13 * | |
14 * This program is distributed in the hope that it will be useful, | |
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 * GNU General Public License for more details. | |
18 * | |
19 * You should have received a copy of the GNU General Public License | |
20 * along with this program; if not, write to the Free Software | |
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
22 */ | |
23 #ifndef _GAIM_PLUGIN_H_ | |
24 #define _GAIM_PLUGIN_H_ | |
5944
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
25 |
5224
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5205
diff
changeset
|
26 #include <gmodule.h> |
6822
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
27 #include "signals.h" |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
28 #include "value.h" |
5205 | 29 |
30 typedef struct _GaimPlugin GaimPlugin; /**< GaimPlugin */ | |
31 typedef struct _GaimPluginInfo GaimPluginInfo; /**< GaimPluginInfo */ | |
32 typedef struct _GaimPluginLoaderInfo GaimPluginLoaderInfo; | |
33 | |
34 typedef int GaimPluginPriority; /**< Plugin priority. */ | |
35 | |
36 /** | |
37 * Plugin types. | |
38 */ | |
5944
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
39 typedef enum |
5205 | 40 { |
41 GAIM_PLUGIN_UNKNOWN = -1, /**< Unknown type. */ | |
42 GAIM_PLUGIN_STANDARD = 0, /**< Standard plugin. */ | |
43 GAIM_PLUGIN_LOADER, /**< Loader plugin. */ | |
44 GAIM_PLUGIN_PROTOCOL /**< Protocol plugin. */ | |
5944
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
45 |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
46 } GaimPluginType; |
5205 | 47 |
48 #define GAIM_PRIORITY_DEFAULT 0 | |
49 #define GAIM_PRIORITY_HIGHEST 9999 | |
50 #define GAIM_PRIORITY_LOWEST -9999 | |
51 | |
52 /** | |
53 * Detailed information about a plugin. | |
54 * | |
55 * This is used in the version 2.0 API and up. | |
56 */ | |
57 struct _GaimPluginInfo | |
58 { | |
59 unsigned int api_version; | |
60 GaimPluginType type; | |
61 char *ui_requirement; | |
62 unsigned long flags; | |
63 GList *dependencies; | |
64 GaimPluginPriority priority; | |
65 | |
66 char *id; | |
67 char *name; | |
68 char *version; | |
69 char *summary; | |
70 char *description; | |
71 char *author; | |
72 char *homepage; | |
73 | |
74 gboolean (*load)(GaimPlugin *plugin); | |
75 gboolean (*unload)(GaimPlugin *plugin); | |
76 void (*destroy)(GaimPlugin *plugin); | |
77 | |
78 void *ui_info; | |
79 void *extra_info; | |
80 }; | |
81 | |
82 /** | |
83 * Extra information for loader plugins. | |
84 */ | |
85 struct _GaimPluginLoaderInfo | |
86 { | |
87 GList *exts; | |
88 | |
89 gboolean (*probe)(GaimPlugin *plugin); | |
90 gboolean (*load)(GaimPlugin *plugin); | |
91 gboolean (*unload)(GaimPlugin *plugin); | |
92 void (*destroy)(GaimPlugin *plugin); | |
93 }; | |
94 | |
95 /** | |
96 * A plugin handle. | |
97 */ | |
98 struct _GaimPlugin | |
99 { | |
100 gboolean native_plugin; /**< Native C plugin. */ | |
101 gboolean loaded; /**< The loaded state. */ | |
102 void *handle; /**< The module handle. */ | |
103 char *path; /**< The path to the plugin. */ | |
104 GaimPluginInfo *info; /**< The plugin information. */ | |
105 char *error; | |
6822
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
106 void *ipc_data; /**< IPC data. */ |
5205 | 107 void *extra; /**< Plugin-specific data. */ |
108 }; | |
109 | |
110 #define GAIM_PLUGIN_LOADER_INFO(plugin) \ | |
111 ((GaimPluginLoaderInfo *)(plugin)->info->extra_info) | |
112 | |
113 /** | |
114 * Handles the initialization of modules. | |
115 */ | |
5449 | 116 #ifndef GAIM_PLUGINS |
5205 | 117 # define GAIM_INIT_PLUGIN(pluginname, initfunc, plugininfo) \ |
118 gboolean gaim_init_##pluginname##_plugin(void) { \ | |
119 GaimPlugin *plugin = gaim_plugin_new(TRUE, NULL); \ | |
120 plugin->info = &(plugininfo); \ | |
121 initfunc((plugin)); \ | |
122 return gaim_plugin_register(plugin); \ | |
123 } | |
5449 | 124 #else /* GAIM_PLUGINS */ |
5205 | 125 # define GAIM_INIT_PLUGIN(pluginname, initfunc, plugininfo) \ |
5224
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5205
diff
changeset
|
126 G_MODULE_EXPORT gboolean gaim_init_plugin(GaimPlugin *plugin) { \ |
5205 | 127 plugin->info = &(plugininfo); \ |
128 initfunc((plugin)); \ | |
129 return gaim_plugin_register(plugin); \ | |
130 } | |
131 #endif | |
132 | |
5944
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
133 #ifdef __cplusplus |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
134 extern "C" { |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
135 #endif |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
136 |
5205 | 137 /**************************************************************************/ |
5944
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
138 /** @name Plugin API */ |
5205 | 139 /**************************************************************************/ |
140 /*@{*/ | |
141 | |
142 /** | |
143 * Creates a new plugin structure. | |
144 * | |
145 * @param native Whether or not the plugin is native. | |
146 * @param path The path to the plugin, or @c NULL if statically compiled. | |
147 * | |
148 * @return A new GaimPlugin structure. | |
149 */ | |
150 GaimPlugin *gaim_plugin_new(gboolean native, const char *path); | |
151 | |
152 /** | |
153 * Probes a plugin, retrieving the information on it and adding it to the | |
154 * list of available plugins. | |
155 * | |
156 * @param filename The plugin's filename. | |
157 * | |
158 * @return The plugin handle. | |
159 * | |
160 * @see gaim_plugin_load() | |
161 * @see gaim_plugin_destroy() | |
162 */ | |
163 GaimPlugin *gaim_plugin_probe(const char *filename); | |
164 | |
165 /** | |
166 * Registers a plugin and prepares it for loading. | |
167 * | |
168 * This shouldn't be called by anything but the internal module code. | |
169 * | |
170 * @param plugin The plugin to register. | |
171 */ | |
172 gboolean gaim_plugin_register(GaimPlugin *plugin); | |
173 | |
174 /** | |
175 * Attempts to load a previously probed plugin. | |
176 * | |
6720
41120df7ed94
[gaim-migrate @ 7247]
Christian Hammond <chipx86@chipx86.com>
parents:
6486
diff
changeset
|
177 * @param plugin The plugin to load. |
5205 | 178 * |
179 * @return @c TRUE if successful, or @c FALSE otherwise. | |
180 * | |
181 * @see gaim_plugin_reload() | |
182 * @see gaim_plugin_unload() | |
183 */ | |
184 gboolean gaim_plugin_load(GaimPlugin *plugin); | |
185 | |
186 /** | |
187 * Unloads the specified plugin. | |
188 * | |
189 * @param plugin The plugin handle. | |
190 * | |
191 * @return @c TRUE if successful, or @c FALSE otherwise. | |
192 * | |
193 * @see gaim_plugin_load() | |
194 * @see gaim_plugin_reload() | |
195 */ | |
196 gboolean gaim_plugin_unload(GaimPlugin *plugin); | |
197 | |
198 /** | |
199 * Reloads a plugin. | |
200 * | |
201 * @param plugin The old plugin handle. | |
6486
fab81e4b885c
[gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
202 * |
5205 | 203 * @return @c TRUE if successful, or @c FALSE otherwise. |
204 * | |
205 * @see gaim_plugin_load() | |
206 * @see gaim_plugin_unload() | |
207 */ | |
208 gboolean gaim_plugin_reload(GaimPlugin *plugin); | |
209 | |
210 /** | |
211 * Unloads a plugin and destroys the structure from memory. | |
212 * | |
213 * @param plugin The plugin handle. | |
214 */ | |
215 void gaim_plugin_destroy(GaimPlugin *plugin); | |
216 | |
217 /** | |
218 * Returns whether or not a plugin is currently loaded. | |
219 * | |
220 * @param plugin The plugin. | |
221 * | |
222 * @return TRUE if loaded, or FALSE otherwise. | |
223 */ | |
224 gboolean gaim_plugin_is_loaded(const GaimPlugin *plugin); | |
225 | |
226 /*@}*/ | |
227 | |
228 /**************************************************************************/ | |
6822
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
229 /** @name Plugin IPC API */ |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
230 /**************************************************************************/ |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
231 /*@{*/ |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
232 |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
233 /** |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
234 * Registers an IPC command in a plugin. |
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 * @param plugin The plugin to register the command with. |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
237 * @param command The name of the command. |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
238 * @param func The function to execute. |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
239 * @param marshal The marshalling function. |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
240 * @param ret_value The return value type. |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
241 * @param num_values The number of parameters. |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
242 * @param ... The parameter types. |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
243 * |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
244 * @return TRUE if the function was registered successfully, or |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
245 * FALSE otherwise. |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
246 */ |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
247 gboolean gaim_plugin_ipc_register(GaimPlugin *plugin, const char *command, |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
248 GaimCallback func, |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
249 GaimSignalMarshalFunc marshal, |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
250 GaimValue *ret_value, int num_params, ...); |
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 * Unregisters an IPC command in a plugin. |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
254 * |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
255 * @param plugin The plugin to unregister the command from. |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
256 * @param command The name of the command. |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
257 */ |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
258 void gaim_plugin_ipc_unregister(GaimPlugin *plugin, const char *command); |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
259 |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
260 /** |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
261 * Unregisters all IPC commands in a plugin. |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
262 * |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
263 * @param plugin The plugin to unregister the commands from. |
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 void gaim_plugin_ipc_unregister_all(GaimPlugin *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 /** |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
268 * Returns a list of value types used for an IPC command. |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
269 * |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
270 * @param plugin The plugin. |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
271 * @param command The name of the command. |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
272 * @param ret_value The returned return value. |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
273 * @param num_params The returned number of parameters. |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
274 * @param params The returned list of parameters. |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
275 * |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
276 * @return TRUE if the command was found, or FALSE otherwise. |
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 gboolean gaim_plugin_ipc_get_params(GaimPlugin *plugin, const char *command, |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
279 GaimValue **ret_value, int *num_params, |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
280 GaimValue ***params); |
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 /** |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
283 * Executes an IPC command. |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
284 * |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
285 * @param plugin The plugin to execute the command on. |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
286 * @param command The name of the command. |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
287 * @param ok TRUE if the call was successful, or FALSE otherwise. |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
288 * @param ... The parameters to pass. |
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 * @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
|
291 * return a value. |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
292 */ |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
293 void *gaim_plugin_ipc_call(GaimPlugin *plugin, const char *command, |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
294 gboolean *ok, ...); |
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 /*@}*/ |
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 /**************************************************************************/ |
5944
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
299 /** @name Plugins API */ |
5205 | 300 /**************************************************************************/ |
301 /*@{*/ | |
302 | |
303 /** | |
304 * Sets the search paths for plugins. | |
305 * | |
306 * @param count The number of search paths. | |
307 * @param paths The search paths. | |
308 */ | |
309 void gaim_plugins_set_search_paths(size_t count, char **paths); | |
310 | |
311 /** | |
5242
fd81a00480ac
[gaim-migrate @ 5613]
Christian Hammond <chipx86@chipx86.com>
parents:
5224
diff
changeset
|
312 * Unloads all loaded plugins. |
5205 | 313 */ |
314 void gaim_plugins_unload_all(void); | |
315 | |
5242
fd81a00480ac
[gaim-migrate @ 5613]
Christian Hammond <chipx86@chipx86.com>
parents:
5224
diff
changeset
|
316 /** |
fd81a00480ac
[gaim-migrate @ 5613]
Christian Hammond <chipx86@chipx86.com>
parents:
5224
diff
changeset
|
317 * Destroys all registered plugins. |
fd81a00480ac
[gaim-migrate @ 5613]
Christian Hammond <chipx86@chipx86.com>
parents:
5224
diff
changeset
|
318 */ |
fd81a00480ac
[gaim-migrate @ 5613]
Christian Hammond <chipx86@chipx86.com>
parents:
5224
diff
changeset
|
319 void gaim_plugins_destroy_all(void); |
fd81a00480ac
[gaim-migrate @ 5613]
Christian Hammond <chipx86@chipx86.com>
parents:
5224
diff
changeset
|
320 |
5205 | 321 /** |
5949
90d0849abd3c
[gaim-migrate @ 6393]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
322 * Attempts to load all the plugins in the specified preference key |
90d0849abd3c
[gaim-migrate @ 6393]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
323 * that were loaded when gaim last quit. |
90d0849abd3c
[gaim-migrate @ 6393]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
324 * |
90d0849abd3c
[gaim-migrate @ 6393]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
325 * @param key The preference key containing the list of plugins. |
5838 | 326 */ |
5949
90d0849abd3c
[gaim-migrate @ 6393]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
327 void gaim_plugins_load_saved(const char *key); |
5838 | 328 |
329 /** | |
5205 | 330 * Probes for plugins in the registered module paths. |
331 * | |
332 * @param ext The extension type to probe for, or @c NULL for all. | |
333 * | |
334 * @see gaim_plugin_set_probe_path() | |
335 */ | |
336 void gaim_plugins_probe(const char *ext); | |
337 | |
338 /** | |
339 * Returns whether or not plugin support is enabled. | |
340 * | |
341 * @return TRUE if plugin support is enabled, or FALSE otherwise. | |
342 */ | |
343 gboolean gaim_plugins_enabled(void); | |
344 | |
345 /** | |
346 * Registers a function that will be called when probing is finished. | |
347 * | |
348 * @param func The callback function. | |
349 * @param data Data to pass to the callback. | |
350 */ | |
351 void gaim_plugins_register_probe_notify_cb(void (*func)(void *), void *data); | |
352 | |
353 /** | |
354 * Unregisters a function that would be called when probing is finished. | |
355 * | |
356 * @param func The callback function. | |
357 */ | |
358 void gaim_plugins_unregister_probe_notify_cb(void (*func)(void *)); | |
359 | |
360 /** | |
361 * Registers a function that will be called when a plugin is loaded. | |
362 * | |
363 * @param func The callback functino. | |
364 * @param data Data to pass to the callback. | |
365 */ | |
366 void gaim_plugins_register_load_notify_cb(void (*func)(GaimPlugin *, void *), | |
367 void *data); | |
368 | |
369 /** | |
370 * Unregisters a function that would be called when a plugin is loaded. | |
371 * | |
372 * @param func The callback functino. | |
373 */ | |
374 void gaim_plugins_unregister_load_notify_cb(void (*func)(GaimPlugin *, void *)); | |
375 | |
376 /** | |
377 * Registers a function that will be called when a plugin is unloaded. | |
378 * | |
379 * @param func The callback functino. | |
380 * @param data Data to pass to the callback. | |
381 */ | |
382 void gaim_plugins_register_unload_notify_cb(void (*func)(GaimPlugin *, void *), | |
383 void *data); | |
384 | |
385 /** | |
386 * Unregisters a function that would be called when a plugin is unloaded. | |
387 * | |
388 * @param func The callback functino. | |
389 */ | |
390 void gaim_plugins_unregister_unload_notify_cb(void (*func)(GaimPlugin *, | |
391 void *)); | |
392 | |
393 /** | |
394 * Finds a plugin with the specified name. | |
395 * | |
396 * @param name The plugin name. | |
397 * | |
398 * @return The plugin if found, or @c NULL if not found. | |
399 */ | |
400 GaimPlugin *gaim_plugins_find_with_name(const char *name); | |
401 | |
402 /** | |
403 * Finds a plugin with the specified filename. | |
404 * | |
405 * @param filename The plugin filename. | |
406 * | |
407 * @return The plugin if found, or @c NULL if not found. | |
408 */ | |
409 GaimPlugin *gaim_plugins_find_with_filename(const char *filename); | |
410 | |
411 /** | |
412 * Finds a plugin with the specified plugin ID. | |
413 * | |
414 * @param id The plugin ID. | |
415 * | |
416 * @return The plugin if found, or @c NULL if not found. | |
417 */ | |
418 GaimPlugin *gaim_plugins_find_with_id(const char *id); | |
419 | |
420 /** | |
421 * Returns a list of all loaded plugins. | |
422 * | |
5573
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5449
diff
changeset
|
423 * @return A list of all loaded plugins. |
5205 | 424 */ |
425 GList *gaim_plugins_get_loaded(void); | |
426 | |
427 /** | |
5573
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5449
diff
changeset
|
428 * Returns a list of all protocol plugins. |
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5449
diff
changeset
|
429 * |
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5449
diff
changeset
|
430 * @return A list of all protocol plugins. |
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5449
diff
changeset
|
431 */ |
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5449
diff
changeset
|
432 GList *gaim_plugins_get_protocols(void); |
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5449
diff
changeset
|
433 |
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5449
diff
changeset
|
434 /** |
5205 | 435 * Returns a list of all plugins, whether loaded or not. |
436 * | |
437 * @return A list of all plugins. | |
438 */ | |
439 GList *gaim_plugins_get_all(void); | |
440 | |
441 /*@}*/ | |
442 | |
5944
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
443 #ifdef __cplusplus |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
444 } |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
445 #endif |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
446 |
5205 | 447 #endif /* _GAIM_PLUGIN_H_ */ |