Mercurial > pidgin.yaz
annotate src/plugin.h @ 9653:5332ebbf437b
[gaim-migrate @ 10501]
" Regarding that bug, I simply wrapped the the assignment
of hostname to dns_params.hostname with g_strstrip().
This allows a lookup by name of a host that had
whitespace after the server hostname (also works if
there is whitespace before the hostname now)" -- jlapenna
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Tue, 03 Aug 2004 23:27:18 +0000 |
parents | 67421e0dc497 |
children | f8e395a054e2 |
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 |
8749
d7b8eb1f0a18
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
33 typedef struct _GaimPlugin GaimPlugin; |
d7b8eb1f0a18
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
34 typedef struct _GaimPluginInfo GaimPluginInfo; |
d7b8eb1f0a18
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
35 typedef struct _GaimPluginUiInfo GaimPluginUiInfo; |
5205 | 36 typedef struct _GaimPluginLoaderInfo GaimPluginLoaderInfo; |
37 | |
9015 | 38 typedef struct _GaimPluginAction GaimPluginAction; |
39 | |
5205 | 40 typedef int GaimPluginPriority; /**< Plugin priority. */ |
41 | |
8713 | 42 #include "pluginpref.h" |
43 | |
5205 | 44 /** |
45 * Plugin types. | |
46 */ | |
5944
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
47 typedef enum |
5205 | 48 { |
49 GAIM_PLUGIN_UNKNOWN = -1, /**< Unknown type. */ | |
50 GAIM_PLUGIN_STANDARD = 0, /**< Standard plugin. */ | |
51 GAIM_PLUGIN_LOADER, /**< Loader plugin. */ | |
52 GAIM_PLUGIN_PROTOCOL /**< Protocol plugin. */ | |
5944
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
53 |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
54 } GaimPluginType; |
5205 | 55 |
56 #define GAIM_PRIORITY_DEFAULT 0 | |
57 #define GAIM_PRIORITY_HIGHEST 9999 | |
58 #define GAIM_PRIORITY_LOWEST -9999 | |
59 | |
6928
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6822
diff
changeset
|
60 #define GAIM_PLUGIN_FLAG_INVISIBLE 0x01 |
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6822
diff
changeset
|
61 |
8990 | 62 #define GAIM_PLUGIN_API_VERSION 4 |
8749
d7b8eb1f0a18
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
63 #define GAIM_LOADER_API_VERSION 2 |
d7b8eb1f0a18
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
64 |
5205 | 65 /** |
66 * Detailed information about a plugin. | |
67 * | |
68 * This is used in the version 2.0 API and up. | |
69 */ | |
70 struct _GaimPluginInfo | |
71 { | |
72 unsigned int api_version; | |
73 GaimPluginType type; | |
74 char *ui_requirement; | |
75 unsigned long flags; | |
76 GList *dependencies; | |
77 GaimPluginPriority priority; | |
78 | |
79 char *id; | |
80 char *name; | |
81 char *version; | |
82 char *summary; | |
83 char *description; | |
84 char *author; | |
85 char *homepage; | |
86 | |
87 gboolean (*load)(GaimPlugin *plugin); | |
88 gboolean (*unload)(GaimPlugin *plugin); | |
89 void (*destroy)(GaimPlugin *plugin); | |
90 | |
91 void *ui_info; | |
92 void *extra_info; | |
8814 | 93 GaimPluginUiInfo *prefs_info; |
9015 | 94 GList *(*actions)(GaimPlugin *plugin, gpointer context); |
5205 | 95 }; |
96 | |
97 /** | |
98 * Extra information for loader plugins. | |
99 */ | |
100 struct _GaimPluginLoaderInfo | |
101 { | |
8749
d7b8eb1f0a18
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
102 unsigned int api_version; |
d7b8eb1f0a18
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
103 |
5205 | 104 GList *exts; |
105 | |
106 gboolean (*probe)(GaimPlugin *plugin); | |
107 gboolean (*load)(GaimPlugin *plugin); | |
108 gboolean (*unload)(GaimPlugin *plugin); | |
109 void (*destroy)(GaimPlugin *plugin); | |
110 }; | |
111 | |
112 /** | |
113 * A plugin handle. | |
114 */ | |
115 struct _GaimPlugin | |
116 { | |
117 gboolean native_plugin; /**< Native C plugin. */ | |
118 gboolean loaded; /**< The loaded state. */ | |
119 void *handle; /**< The module handle. */ | |
120 char *path; /**< The path to the plugin. */ | |
121 GaimPluginInfo *info; /**< The plugin information. */ | |
122 char *error; | |
6822
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
123 void *ipc_data; /**< IPC data. */ |
5205 | 124 void *extra; /**< Plugin-specific data. */ |
125 }; | |
126 | |
127 #define GAIM_PLUGIN_LOADER_INFO(plugin) \ | |
128 ((GaimPluginLoaderInfo *)(plugin)->info->extra_info) | |
129 | |
8713 | 130 struct _GaimPluginUiInfo { |
131 GaimPluginPrefFrame *(*get_plugin_pref_frame)(GaimPlugin *plugin); | |
132 | |
133 void *iter; /**< Reserved */ | |
8814 | 134 GaimPluginPrefFrame *frame; /**< Reserved */ |
8713 | 135 }; |
136 | |
137 #define GAIM_PLUGIN_HAS_PREF_FRAME(plugin) \ | |
138 ((plugin)->info != NULL && (plugin)->info->prefs_info != NULL) | |
139 | |
140 #define GAIM_PLUGIN_UI_INFO(plugin) \ | |
141 ((GaimPluginUiInfo*)(plugin)->info->prefs_info) | |
142 | |
9015 | 143 |
144 /** | |
145 * The structure used in the actions member of GaimPluginInfo | |
146 */ | |
147 struct _GaimPluginAction { | |
148 char *label; | |
149 void (*callback)(GaimPluginAction *); | |
150 | |
151 /** set to the owning plugin */ | |
152 GaimPlugin *plugin; | |
153 | |
154 /** NULL for plugin actions menu, set to the GaimConnection for | |
155 account actions menu */ | |
156 gpointer context; | |
157 }; | |
158 | |
159 #define GAIM_PLUGIN_HAS_ACTIONS(plugin) \ | |
160 ((plugin)->info != NULL && (plugin)->info->actions != NULL) | |
161 | |
162 #define GAIM_PLUGIN_ACTIONS(plugin, context) \ | |
163 (GAIM_PLUGIN_HAS_ACTIONS(plugin)? \ | |
164 (plugin)->info->actions(plugin, context): NULL) | |
165 | |
166 | |
5205 | 167 /** |
168 * Handles the initialization of modules. | |
169 */ | |
8082 | 170 #if !defined(GAIM_PLUGINS) || defined(GAIM_STATIC_PRPL) |
5205 | 171 # define GAIM_INIT_PLUGIN(pluginname, initfunc, plugininfo) \ |
172 gboolean gaim_init_##pluginname##_plugin(void) { \ | |
173 GaimPlugin *plugin = gaim_plugin_new(TRUE, NULL); \ | |
174 plugin->info = &(plugininfo); \ | |
175 initfunc((plugin)); \ | |
176 return gaim_plugin_register(plugin); \ | |
177 } | |
8082 | 178 #else /* GAIM_PLUGINS && !GAIM_STATIC_PRPL */ |
5205 | 179 # define GAIM_INIT_PLUGIN(pluginname, initfunc, plugininfo) \ |
5224
5160333a80df
[gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5205
diff
changeset
|
180 G_MODULE_EXPORT gboolean gaim_init_plugin(GaimPlugin *plugin) { \ |
5205 | 181 plugin->info = &(plugininfo); \ |
182 initfunc((plugin)); \ | |
183 return gaim_plugin_register(plugin); \ | |
184 } | |
185 #endif | |
186 | |
9015 | 187 |
5944
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
188 #ifdef __cplusplus |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
189 extern "C" { |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
190 #endif |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
191 |
8986 | 192 |
193 void *gaim_plugins_get_handle(void); | |
194 | |
195 | |
5205 | 196 /**************************************************************************/ |
5944
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
197 /** @name Plugin API */ |
5205 | 198 /**************************************************************************/ |
199 /*@{*/ | |
200 | |
201 /** | |
202 * Creates a new plugin structure. | |
203 * | |
204 * @param native Whether or not the plugin is native. | |
205 * @param path The path to the plugin, or @c NULL if statically compiled. | |
206 * | |
207 * @return A new GaimPlugin structure. | |
208 */ | |
209 GaimPlugin *gaim_plugin_new(gboolean native, const char *path); | |
210 | |
211 /** | |
212 * Probes a plugin, retrieving the information on it and adding it to the | |
213 * list of available plugins. | |
214 * | |
215 * @param filename The plugin's filename. | |
216 * | |
217 * @return The plugin handle. | |
218 * | |
219 * @see gaim_plugin_load() | |
220 * @see gaim_plugin_destroy() | |
221 */ | |
222 GaimPlugin *gaim_plugin_probe(const char *filename); | |
223 | |
224 /** | |
225 * Registers a plugin and prepares it for loading. | |
226 * | |
227 * This shouldn't be called by anything but the internal module code. | |
228 * | |
229 * @param plugin The plugin to register. | |
230 */ | |
231 gboolean gaim_plugin_register(GaimPlugin *plugin); | |
232 | |
233 /** | |
234 * Attempts to load a previously probed plugin. | |
235 * | |
6720
41120df7ed94
[gaim-migrate @ 7247]
Christian Hammond <chipx86@chipx86.com>
parents:
6486
diff
changeset
|
236 * @param plugin The plugin to load. |
5205 | 237 * |
238 * @return @c TRUE if successful, or @c FALSE otherwise. | |
239 * | |
240 * @see gaim_plugin_reload() | |
241 * @see gaim_plugin_unload() | |
242 */ | |
243 gboolean gaim_plugin_load(GaimPlugin *plugin); | |
244 | |
245 /** | |
246 * Unloads the specified plugin. | |
247 * | |
248 * @param plugin The plugin handle. | |
249 * | |
250 * @return @c TRUE if successful, or @c FALSE otherwise. | |
251 * | |
252 * @see gaim_plugin_load() | |
253 * @see gaim_plugin_reload() | |
254 */ | |
255 gboolean gaim_plugin_unload(GaimPlugin *plugin); | |
256 | |
257 /** | |
258 * Reloads a plugin. | |
259 * | |
260 * @param plugin The old plugin handle. | |
6486
fab81e4b885c
[gaim-migrate @ 7000]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
261 * |
5205 | 262 * @return @c TRUE if successful, or @c FALSE otherwise. |
263 * | |
264 * @see gaim_plugin_load() | |
265 * @see gaim_plugin_unload() | |
266 */ | |
267 gboolean gaim_plugin_reload(GaimPlugin *plugin); | |
268 | |
269 /** | |
270 * Unloads a plugin and destroys the structure from memory. | |
271 * | |
272 * @param plugin The plugin handle. | |
273 */ | |
274 void gaim_plugin_destroy(GaimPlugin *plugin); | |
275 | |
276 /** | |
277 * Returns whether or not a plugin is currently loaded. | |
278 * | |
279 * @param plugin The plugin. | |
280 * | |
281 * @return TRUE if loaded, or FALSE otherwise. | |
282 */ | |
283 gboolean gaim_plugin_is_loaded(const GaimPlugin *plugin); | |
284 | |
285 /*@}*/ | |
286 | |
287 /**************************************************************************/ | |
6822
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
288 /** @name Plugin IPC API */ |
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 /*@{*/ |
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 /** |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
293 * Registers an IPC command in a plugin. |
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 * @param plugin The plugin to register the command with. |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
296 * @param command The name of the command. |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
297 * @param func The function to execute. |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
298 * @param marshal The marshalling function. |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
299 * @param ret_value The return value type. |
7114
c47633e9e2a4
[gaim-migrate @ 7681]
Christian Hammond <chipx86@chipx86.com>
parents:
7034
diff
changeset
|
300 * @param num_params The number of parameters. |
6822
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
301 * @param ... The parameter types. |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
302 * |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
303 * @return TRUE if the function was registered successfully, or |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
304 * FALSE otherwise. |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
305 */ |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
306 gboolean gaim_plugin_ipc_register(GaimPlugin *plugin, const char *command, |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
307 GaimCallback func, |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
308 GaimSignalMarshalFunc marshal, |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
309 GaimValue *ret_value, int num_params, ...); |
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 /** |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
312 * Unregisters an IPC command in a plugin. |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
313 * |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
314 * @param plugin The plugin to unregister the command from. |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
315 * @param command The name of the command. |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
316 */ |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
317 void gaim_plugin_ipc_unregister(GaimPlugin *plugin, const char *command); |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
318 |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
319 /** |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
320 * Unregisters all IPC commands in a plugin. |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
321 * |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
322 * @param plugin The plugin to unregister the commands from. |
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 void gaim_plugin_ipc_unregister_all(GaimPlugin *plugin); |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
325 |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
326 /** |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
327 * Returns a list of value types used for an IPC command. |
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 * @param plugin The plugin. |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
330 * @param command The name of the command. |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
331 * @param ret_value The returned return value. |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
332 * @param num_params The returned number of parameters. |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
333 * @param params The returned list of parameters. |
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 * @return TRUE if the command was found, or FALSE otherwise. |
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 gboolean gaim_plugin_ipc_get_params(GaimPlugin *plugin, const char *command, |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
338 GaimValue **ret_value, int *num_params, |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
339 GaimValue ***params); |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
340 |
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 * Executes an IPC command. |
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 * @param plugin The plugin to execute the command on. |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
345 * @param command The name of the command. |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
346 * @param ok TRUE if the call was successful, or FALSE otherwise. |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
347 * @param ... The parameters to pass. |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
348 * |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
349 * @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
|
350 * return a value. |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
351 */ |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
352 void *gaim_plugin_ipc_call(GaimPlugin *plugin, const char *command, |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
353 gboolean *ok, ...); |
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 /*@}*/ |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
356 |
7dba3e17cb21
[gaim-migrate @ 7366]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
357 /**************************************************************************/ |
5944
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
358 /** @name Plugins API */ |
5205 | 359 /**************************************************************************/ |
360 /*@{*/ | |
361 | |
362 /** | |
363 * Sets the search paths for plugins. | |
364 * | |
365 * @param count The number of search paths. | |
366 * @param paths The search paths. | |
367 */ | |
368 void gaim_plugins_set_search_paths(size_t count, char **paths); | |
369 | |
370 /** | |
5242
fd81a00480ac
[gaim-migrate @ 5613]
Christian Hammond <chipx86@chipx86.com>
parents:
5224
diff
changeset
|
371 * Unloads all loaded plugins. |
5205 | 372 */ |
373 void gaim_plugins_unload_all(void); | |
374 | |
5242
fd81a00480ac
[gaim-migrate @ 5613]
Christian Hammond <chipx86@chipx86.com>
parents:
5224
diff
changeset
|
375 /** |
fd81a00480ac
[gaim-migrate @ 5613]
Christian Hammond <chipx86@chipx86.com>
parents:
5224
diff
changeset
|
376 * Destroys all registered plugins. |
fd81a00480ac
[gaim-migrate @ 5613]
Christian Hammond <chipx86@chipx86.com>
parents:
5224
diff
changeset
|
377 */ |
fd81a00480ac
[gaim-migrate @ 5613]
Christian Hammond <chipx86@chipx86.com>
parents:
5224
diff
changeset
|
378 void gaim_plugins_destroy_all(void); |
fd81a00480ac
[gaim-migrate @ 5613]
Christian Hammond <chipx86@chipx86.com>
parents:
5224
diff
changeset
|
379 |
5205 | 380 /** |
5949
90d0849abd3c
[gaim-migrate @ 6393]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
381 * Attempts to load all the plugins in the specified preference key |
90d0849abd3c
[gaim-migrate @ 6393]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
382 * that were loaded when gaim last quit. |
90d0849abd3c
[gaim-migrate @ 6393]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
383 * |
90d0849abd3c
[gaim-migrate @ 6393]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
384 * @param key The preference key containing the list of plugins. |
5838 | 385 */ |
5949
90d0849abd3c
[gaim-migrate @ 6393]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
386 void gaim_plugins_load_saved(const char *key); |
5838 | 387 |
388 /** | |
5205 | 389 * Probes for plugins in the registered module paths. |
390 * | |
391 * @param ext The extension type to probe for, or @c NULL for all. | |
392 * | |
393 * @see gaim_plugin_set_probe_path() | |
394 */ | |
395 void gaim_plugins_probe(const char *ext); | |
396 | |
397 /** | |
398 * Returns whether or not plugin support is enabled. | |
399 * | |
400 * @return TRUE if plugin support is enabled, or FALSE otherwise. | |
401 */ | |
402 gboolean gaim_plugins_enabled(void); | |
403 | |
404 /** | |
405 * Registers a function that will be called when probing is finished. | |
406 * | |
407 * @param func The callback function. | |
408 * @param data Data to pass to the callback. | |
409 */ | |
410 void gaim_plugins_register_probe_notify_cb(void (*func)(void *), void *data); | |
411 | |
412 /** | |
413 * Unregisters a function that would be called when probing is finished. | |
414 * | |
415 * @param func The callback function. | |
416 */ | |
417 void gaim_plugins_unregister_probe_notify_cb(void (*func)(void *)); | |
418 | |
419 /** | |
420 * Registers a function that will be called when a plugin is loaded. | |
421 * | |
8735
92cbf9713795
[gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents:
8713
diff
changeset
|
422 * @param func The callback function. |
5205 | 423 * @param data Data to pass to the callback. |
424 */ | |
425 void gaim_plugins_register_load_notify_cb(void (*func)(GaimPlugin *, void *), | |
426 void *data); | |
427 | |
428 /** | |
429 * Unregisters a function that would be called when a plugin is loaded. | |
430 * | |
8735
92cbf9713795
[gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents:
8713
diff
changeset
|
431 * @param func The callback function. |
5205 | 432 */ |
433 void gaim_plugins_unregister_load_notify_cb(void (*func)(GaimPlugin *, void *)); | |
434 | |
435 /** | |
436 * Registers a function that will be called when a plugin is unloaded. | |
437 * | |
8735
92cbf9713795
[gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents:
8713
diff
changeset
|
438 * @param func The callback function. |
5205 | 439 * @param data Data to pass to the callback. |
440 */ | |
441 void gaim_plugins_register_unload_notify_cb(void (*func)(GaimPlugin *, void *), | |
442 void *data); | |
443 | |
444 /** | |
445 * Unregisters a function that would be called when a plugin is unloaded. | |
446 * | |
8735
92cbf9713795
[gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents:
8713
diff
changeset
|
447 * @param func The callback function. |
5205 | 448 */ |
449 void gaim_plugins_unregister_unload_notify_cb(void (*func)(GaimPlugin *, | |
450 void *)); | |
451 | |
452 /** | |
453 * Finds a plugin with the specified name. | |
454 * | |
455 * @param name The plugin name. | |
456 * | |
457 * @return The plugin if found, or @c NULL if not found. | |
458 */ | |
459 GaimPlugin *gaim_plugins_find_with_name(const char *name); | |
460 | |
461 /** | |
7034
f7ff0dfa6b9f
[gaim-migrate @ 7597]
Christian Hammond <chipx86@chipx86.com>
parents:
7033
diff
changeset
|
462 * Finds a plugin with the specified filename (filename with a path). |
5205 | 463 * |
464 * @param filename The plugin filename. | |
465 * | |
466 * @return The plugin if found, or @c NULL if not found. | |
467 */ | |
468 GaimPlugin *gaim_plugins_find_with_filename(const char *filename); | |
469 | |
470 /** | |
7034
f7ff0dfa6b9f
[gaim-migrate @ 7597]
Christian Hammond <chipx86@chipx86.com>
parents:
7033
diff
changeset
|
471 * 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
|
472 * |
7034
f7ff0dfa6b9f
[gaim-migrate @ 7597]
Christian Hammond <chipx86@chipx86.com>
parents:
7033
diff
changeset
|
473 * @param basename The plugin basename. |
7033
cf1126ba1834
[gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents:
6928
diff
changeset
|
474 * |
cf1126ba1834
[gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents:
6928
diff
changeset
|
475 * @return The plugin if found, or @c NULL if not found. |
cf1126ba1834
[gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents:
6928
diff
changeset
|
476 */ |
cf1126ba1834
[gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents:
6928
diff
changeset
|
477 GaimPlugin *gaim_plugins_find_with_basename(const char *basename); |
cf1126ba1834
[gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents:
6928
diff
changeset
|
478 |
cf1126ba1834
[gaim-migrate @ 7596]
Christian Hammond <chipx86@chipx86.com>
parents:
6928
diff
changeset
|
479 /** |
5205 | 480 * Finds a plugin with the specified plugin ID. |
481 * | |
482 * @param id The plugin ID. | |
483 * | |
484 * @return The plugin if found, or @c NULL if not found. | |
485 */ | |
486 GaimPlugin *gaim_plugins_find_with_id(const char *id); | |
487 | |
488 /** | |
489 * Returns a list of all loaded plugins. | |
490 * | |
5573
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5449
diff
changeset
|
491 * @return A list of all loaded plugins. |
5205 | 492 */ |
493 GList *gaim_plugins_get_loaded(void); | |
494 | |
495 /** | |
5573
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5449
diff
changeset
|
496 * Returns a list of all protocol plugins. |
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5449
diff
changeset
|
497 * |
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5449
diff
changeset
|
498 * @return A list of all protocol plugins. |
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5449
diff
changeset
|
499 */ |
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5449
diff
changeset
|
500 GList *gaim_plugins_get_protocols(void); |
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5449
diff
changeset
|
501 |
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5449
diff
changeset
|
502 /** |
5205 | 503 * Returns a list of all plugins, whether loaded or not. |
504 * | |
505 * @return A list of all plugins. | |
506 */ | |
507 GList *gaim_plugins_get_all(void); | |
508 | |
509 /*@}*/ | |
510 | |
9015 | 511 |
512 /** | |
513 * Allocates and returns a new GaimPluginAction. | |
514 */ | |
515 GaimPluginAction *gaim_plugin_action_new(char* label, void (*callback)(GaimPluginAction *)); | |
516 | |
5944
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
517 #ifdef __cplusplus |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
518 } |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
519 #endif |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5840
diff
changeset
|
520 |
5205 | 521 #endif /* _GAIM_PLUGIN_H_ */ |