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