Mercurial > pidgin
comparison libpurple/plugin.h @ 15822:32c366eeeb99
sed -ie 's/gaim/purple/g'
| author | Sean Egan <seanegan@gmail.com> |
|---|---|
| date | Mon, 19 Mar 2007 07:01:17 +0000 |
| parents | 5fe8042783c1 |
| children | 516f14bef90e |
comparison
equal
deleted
inserted
replaced
| 15821:84b0f9b23ede | 15822:32c366eeeb99 |
|---|---|
| 1 /** | 1 /** |
| 2 * @file plugin.h Plugin API | 2 * @file plugin.h Plugin API |
| 3 * @ingroup core | 3 * @ingroup core |
| 4 * | 4 * |
| 5 * gaim | 5 * purple |
| 6 * | 6 * |
| 7 * Gaim is the legal property of its developers, whose names are too numerous | 7 * Purple 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 | 8 * to list here. Please refer to the COPYRIGHT file distributed with this |
| 9 * source distribution. | 9 * source distribution. |
| 10 * | 10 * |
| 11 * This program is free software; you can redistribute it and/or modify | 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 | 12 * it under the terms of the GNU General Public License as published by |
| 20 * | 20 * |
| 21 * You should have received a copy of the GNU General Public License | 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 | 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 | 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 24 */ | 24 */ |
| 25 #ifndef _GAIM_PLUGIN_H_ | 25 #ifndef _PURPLE_PLUGIN_H_ |
| 26 #define _GAIM_PLUGIN_H_ | 26 #define _PURPLE_PLUGIN_H_ |
| 27 | 27 |
| 28 #include <glib/glist.h> | 28 #include <glib/glist.h> |
| 29 #include <gmodule.h> | 29 #include <gmodule.h> |
| 30 #include "signals.h" | 30 #include "signals.h" |
| 31 #include "value.h" | 31 #include "value.h" |
| 32 | 32 |
| 33 typedef struct _GaimPlugin GaimPlugin; | 33 typedef struct _PurplePlugin PurplePlugin; |
| 34 typedef struct _GaimPluginInfo GaimPluginInfo; | 34 typedef struct _PurplePluginInfo PurplePluginInfo; |
| 35 typedef struct _GaimPluginUiInfo GaimPluginUiInfo; | 35 typedef struct _PurplePluginUiInfo PurplePluginUiInfo; |
| 36 typedef struct _GaimPluginLoaderInfo GaimPluginLoaderInfo; | 36 typedef struct _PurplePluginLoaderInfo PurplePluginLoaderInfo; |
| 37 | 37 |
| 38 typedef struct _GaimPluginAction GaimPluginAction; | 38 typedef struct _PurplePluginAction PurplePluginAction; |
| 39 | 39 |
| 40 typedef int GaimPluginPriority; /**< Plugin priority. */ | 40 typedef int PurplePluginPriority; /**< Plugin priority. */ |
| 41 | 41 |
| 42 #include "pluginpref.h" | 42 #include "pluginpref.h" |
| 43 | 43 |
| 44 /** | 44 /** |
| 45 * Plugin types. | 45 * Plugin types. |
| 46 */ | 46 */ |
| 47 typedef enum | 47 typedef enum |
| 48 { | 48 { |
| 49 GAIM_PLUGIN_UNKNOWN = -1, /**< Unknown type. */ | 49 PURPLE_PLUGIN_UNKNOWN = -1, /**< Unknown type. */ |
| 50 GAIM_PLUGIN_STANDARD = 0, /**< Standard plugin. */ | 50 PURPLE_PLUGIN_STANDARD = 0, /**< Standard plugin. */ |
| 51 GAIM_PLUGIN_LOADER, /**< Loader plugin. */ | 51 PURPLE_PLUGIN_LOADER, /**< Loader plugin. */ |
| 52 GAIM_PLUGIN_PROTOCOL /**< Protocol plugin. */ | 52 PURPLE_PLUGIN_PROTOCOL /**< Protocol plugin. */ |
| 53 | 53 |
| 54 } GaimPluginType; | 54 } PurplePluginType; |
| 55 | 55 |
| 56 #define GAIM_PRIORITY_DEFAULT 0 | 56 #define PURPLE_PRIORITY_DEFAULT 0 |
| 57 #define GAIM_PRIORITY_HIGHEST 9999 | 57 #define PURPLE_PRIORITY_HIGHEST 9999 |
| 58 #define GAIM_PRIORITY_LOWEST -9999 | 58 #define PURPLE_PRIORITY_LOWEST -9999 |
| 59 | 59 |
| 60 #define GAIM_PLUGIN_FLAG_INVISIBLE 0x01 | 60 #define PURPLE_PLUGIN_FLAG_INVISIBLE 0x01 |
| 61 | 61 |
| 62 #define GAIM_PLUGIN_MAGIC 5 /* once we hit 6.0.0 I think we can remove this */ | 62 #define PURPLE_PLUGIN_MAGIC 5 /* once we hit 6.0.0 I think we can remove this */ |
| 63 | 63 |
| 64 /** | 64 /** |
| 65 * Detailed information about a plugin. | 65 * Detailed information about a plugin. |
| 66 * | 66 * |
| 67 * This is used in the version 2.0 API and up. | 67 * This is used in the version 2.0 API and up. |
| 69 /* TODO We need to figure out exactly what parts of this are required. The | 69 /* TODO We need to figure out exactly what parts of this are required. The |
| 70 * dependent plugin unloading stuff was causing crashes with perl and tcl | 70 * dependent plugin unloading stuff was causing crashes with perl and tcl |
| 71 * plugins because they didn't set ids and the dependency code was requiring | 71 * plugins because they didn't set ids and the dependency code was requiring |
| 72 * them. Then we need to actually make sure that plugins have all the right | 72 * them. Then we need to actually make sure that plugins have all the right |
| 73 * parts before loading them. */ | 73 * parts before loading them. */ |
| 74 struct _GaimPluginInfo | 74 struct _PurplePluginInfo |
| 75 { | 75 { |
| 76 unsigned int magic; | 76 unsigned int magic; |
| 77 unsigned int major_version; | 77 unsigned int major_version; |
| 78 unsigned int minor_version; | 78 unsigned int minor_version; |
| 79 GaimPluginType type; | 79 PurplePluginType type; |
| 80 char *ui_requirement; | 80 char *ui_requirement; |
| 81 unsigned long flags; | 81 unsigned long flags; |
| 82 GList *dependencies; | 82 GList *dependencies; |
| 83 GaimPluginPriority priority; | 83 PurplePluginPriority priority; |
| 84 | 84 |
| 85 char *id; | 85 char *id; |
| 86 char *name; | 86 char *name; |
| 87 char *version; | 87 char *version; |
| 88 char *summary; | 88 char *summary; |
| 92 | 92 |
| 93 /** | 93 /** |
| 94 * If a plugin defines a 'load' function, and it returns FALSE, | 94 * If a plugin defines a 'load' function, and it returns FALSE, |
| 95 * then the plugin will not be loaded. | 95 * then the plugin will not be loaded. |
| 96 */ | 96 */ |
| 97 gboolean (*load)(GaimPlugin *plugin); | 97 gboolean (*load)(PurplePlugin *plugin); |
| 98 gboolean (*unload)(GaimPlugin *plugin); | 98 gboolean (*unload)(PurplePlugin *plugin); |
| 99 void (*destroy)(GaimPlugin *plugin); | 99 void (*destroy)(PurplePlugin *plugin); |
| 100 | 100 |
| 101 void *ui_info; /**< Used only by UI-specific plugins to build a preference screen with a custom UI */ | 101 void *ui_info; /**< Used only by UI-specific plugins to build a preference screen with a custom UI */ |
| 102 void *extra_info; | 102 void *extra_info; |
| 103 GaimPluginUiInfo *prefs_info; /**< Used by any plugin to display preferences. If #ui_info has been specified, this will be ignored. */ | 103 PurplePluginUiInfo *prefs_info; /**< Used by any plugin to display preferences. If #ui_info has been specified, this will be ignored. */ |
| 104 GList *(*actions)(GaimPlugin *plugin, gpointer context); | 104 GList *(*actions)(PurplePlugin *plugin, gpointer context); |
| 105 }; | 105 }; |
| 106 | 106 |
| 107 /** | 107 /** |
| 108 * Extra information for loader plugins. | 108 * Extra information for loader plugins. |
| 109 */ | 109 */ |
| 110 struct _GaimPluginLoaderInfo | 110 struct _PurplePluginLoaderInfo |
| 111 { | 111 { |
| 112 GList *exts; | 112 GList *exts; |
| 113 | 113 |
| 114 gboolean (*probe)(GaimPlugin *plugin); | 114 gboolean (*probe)(PurplePlugin *plugin); |
| 115 gboolean (*load)(GaimPlugin *plugin); | 115 gboolean (*load)(PurplePlugin *plugin); |
| 116 gboolean (*unload)(GaimPlugin *plugin); | 116 gboolean (*unload)(PurplePlugin *plugin); |
| 117 void (*destroy)(GaimPlugin *plugin); | 117 void (*destroy)(PurplePlugin *plugin); |
| 118 }; | 118 }; |
| 119 | 119 |
| 120 /** | 120 /** |
| 121 * A plugin handle. | 121 * A plugin handle. |
| 122 */ | 122 */ |
| 123 struct _GaimPlugin | 123 struct _PurplePlugin |
| 124 { | 124 { |
| 125 gboolean native_plugin; /**< Native C plugin. */ | 125 gboolean native_plugin; /**< Native C plugin. */ |
| 126 gboolean loaded; /**< The loaded state. */ | 126 gboolean loaded; /**< The loaded state. */ |
| 127 void *handle; /**< The module handle. */ | 127 void *handle; /**< The module handle. */ |
| 128 char *path; /**< The path to the plugin. */ | 128 char *path; /**< The path to the plugin. */ |
| 129 GaimPluginInfo *info; /**< The plugin information. */ | 129 PurplePluginInfo *info; /**< The plugin information. */ |
| 130 char *error; | 130 char *error; |
| 131 void *ipc_data; /**< IPC data. */ | 131 void *ipc_data; /**< IPC data. */ |
| 132 void *extra; /**< Plugin-specific data. */ | 132 void *extra; /**< Plugin-specific data. */ |
| 133 gboolean unloadable; /**< Unloadable */ | 133 gboolean unloadable; /**< Unloadable */ |
| 134 GList *dependent_plugins; /**< Plugins depending on this */ | 134 GList *dependent_plugins; /**< Plugins depending on this */ |
| 135 }; | 135 }; |
| 136 | 136 |
| 137 #define GAIM_PLUGIN_LOADER_INFO(plugin) \ | 137 #define PURPLE_PLUGIN_LOADER_INFO(plugin) \ |
| 138 ((GaimPluginLoaderInfo *)(plugin)->info->extra_info) | 138 ((PurplePluginLoaderInfo *)(plugin)->info->extra_info) |
| 139 | 139 |
| 140 struct _GaimPluginUiInfo { | 140 struct _PurplePluginUiInfo { |
| 141 GaimPluginPrefFrame *(*get_plugin_pref_frame)(GaimPlugin *plugin); | 141 PurplePluginPrefFrame *(*get_plugin_pref_frame)(PurplePlugin *plugin); |
| 142 | 142 |
| 143 int page_num; /**< Reserved */ | 143 int page_num; /**< Reserved */ |
| 144 GaimPluginPrefFrame *frame; /**< Reserved */ | 144 PurplePluginPrefFrame *frame; /**< Reserved */ |
| 145 }; | 145 }; |
| 146 | 146 |
| 147 #define GAIM_PLUGIN_HAS_PREF_FRAME(plugin) \ | 147 #define PURPLE_PLUGIN_HAS_PREF_FRAME(plugin) \ |
| 148 ((plugin)->info != NULL && (plugin)->info->prefs_info != NULL) | 148 ((plugin)->info != NULL && (plugin)->info->prefs_info != NULL) |
| 149 | 149 |
| 150 #define GAIM_PLUGIN_UI_INFO(plugin) \ | 150 #define PURPLE_PLUGIN_UI_INFO(plugin) \ |
| 151 ((GaimPluginUiInfo*)(plugin)->info->prefs_info) | 151 ((PurplePluginUiInfo*)(plugin)->info->prefs_info) |
| 152 | 152 |
| 153 | 153 |
| 154 /** | 154 /** |
| 155 * The structure used in the actions member of GaimPluginInfo | 155 * The structure used in the actions member of PurplePluginInfo |
| 156 */ | 156 */ |
| 157 struct _GaimPluginAction { | 157 struct _PurplePluginAction { |
| 158 char *label; | 158 char *label; |
| 159 void (*callback)(GaimPluginAction *); | 159 void (*callback)(PurplePluginAction *); |
| 160 | 160 |
| 161 /** set to the owning plugin */ | 161 /** set to the owning plugin */ |
| 162 GaimPlugin *plugin; | 162 PurplePlugin *plugin; |
| 163 | 163 |
| 164 /** NULL for plugin actions menu, set to the GaimConnection for | 164 /** NULL for plugin actions menu, set to the PurpleConnection for |
| 165 account actions menu */ | 165 account actions menu */ |
| 166 gpointer context; | 166 gpointer context; |
| 167 }; | 167 }; |
| 168 | 168 |
| 169 #define GAIM_PLUGIN_HAS_ACTIONS(plugin) \ | 169 #define PURPLE_PLUGIN_HAS_ACTIONS(plugin) \ |
| 170 ((plugin)->info != NULL && (plugin)->info->actions != NULL) | 170 ((plugin)->info != NULL && (plugin)->info->actions != NULL) |
| 171 | 171 |
| 172 #define GAIM_PLUGIN_ACTIONS(plugin, context) \ | 172 #define PURPLE_PLUGIN_ACTIONS(plugin, context) \ |
| 173 (GAIM_PLUGIN_HAS_ACTIONS(plugin)? \ | 173 (PURPLE_PLUGIN_HAS_ACTIONS(plugin)? \ |
| 174 (plugin)->info->actions(plugin, context): NULL) | 174 (plugin)->info->actions(plugin, context): NULL) |
| 175 | 175 |
| 176 | 176 |
| 177 /** | 177 /** |
| 178 * Handles the initialization of modules. | 178 * Handles the initialization of modules. |
| 179 */ | 179 */ |
| 180 #if !defined(GAIM_PLUGINS) || defined(GAIM_STATIC_PRPL) | 180 #if !defined(PURPLE_PLUGINS) || defined(PURPLE_STATIC_PRPL) |
| 181 # define GAIM_INIT_PLUGIN(pluginname, initfunc, plugininfo) \ | 181 # define PURPLE_INIT_PLUGIN(pluginname, initfunc, plugininfo) \ |
| 182 gboolean gaim_init_##pluginname##_plugin(void);\ | 182 gboolean purple_init_##pluginname##_plugin(void);\ |
| 183 gboolean gaim_init_##pluginname##_plugin(void) { \ | 183 gboolean purple_init_##pluginname##_plugin(void) { \ |
| 184 GaimPlugin *plugin = gaim_plugin_new(TRUE, NULL); \ | 184 PurplePlugin *plugin = purple_plugin_new(TRUE, NULL); \ |
| 185 plugin->info = &(plugininfo); \ | 185 plugin->info = &(plugininfo); \ |
| 186 initfunc((plugin)); \ | 186 initfunc((plugin)); \ |
| 187 gaim_plugin_load((plugin)); \ | 187 purple_plugin_load((plugin)); \ |
| 188 return gaim_plugin_register(plugin); \ | 188 return purple_plugin_register(plugin); \ |
| 189 } | 189 } |
| 190 #else /* GAIM_PLUGINS && !GAIM_STATIC_PRPL */ | 190 #else /* PURPLE_PLUGINS && !PURPLE_STATIC_PRPL */ |
| 191 # define GAIM_INIT_PLUGIN(pluginname, initfunc, plugininfo) \ | 191 # define PURPLE_INIT_PLUGIN(pluginname, initfunc, plugininfo) \ |
| 192 G_MODULE_EXPORT gboolean gaim_init_plugin(GaimPlugin *plugin); \ | 192 G_MODULE_EXPORT gboolean purple_init_plugin(PurplePlugin *plugin); \ |
| 193 G_MODULE_EXPORT gboolean gaim_init_plugin(GaimPlugin *plugin) { \ | 193 G_MODULE_EXPORT gboolean purple_init_plugin(PurplePlugin *plugin) { \ |
| 194 plugin->info = &(plugininfo); \ | 194 plugin->info = &(plugininfo); \ |
| 195 initfunc((plugin)); \ | 195 initfunc((plugin)); \ |
| 196 return gaim_plugin_register(plugin); \ | 196 return purple_plugin_register(plugin); \ |
| 197 } | 197 } |
| 198 #endif | 198 #endif |
| 199 | 199 |
| 200 | 200 |
| 201 #ifdef __cplusplus | 201 #ifdef __cplusplus |
| 211 * Creates a new plugin structure. | 211 * Creates a new plugin structure. |
| 212 * | 212 * |
| 213 * @param native Whether or not the plugin is native. | 213 * @param native Whether or not the plugin is native. |
| 214 * @param path The path to the plugin, or @c NULL if statically compiled. | 214 * @param path The path to the plugin, or @c NULL if statically compiled. |
| 215 * | 215 * |
| 216 * @return A new GaimPlugin structure. | 216 * @return A new PurplePlugin structure. |
| 217 */ | 217 */ |
| 218 GaimPlugin *gaim_plugin_new(gboolean native, const char *path); | 218 PurplePlugin *purple_plugin_new(gboolean native, const char *path); |
| 219 | 219 |
| 220 /** | 220 /** |
| 221 * Probes a plugin, retrieving the information on it and adding it to the | 221 * Probes a plugin, retrieving the information on it and adding it to the |
| 222 * list of available plugins. | 222 * list of available plugins. |
| 223 * | 223 * |
| 224 * @param filename The plugin's filename. | 224 * @param filename The plugin's filename. |
| 225 * | 225 * |
| 226 * @return The plugin handle. | 226 * @return The plugin handle. |
| 227 * | 227 * |
| 228 * @see gaim_plugin_load() | 228 * @see purple_plugin_load() |
| 229 * @see gaim_plugin_destroy() | 229 * @see purple_plugin_destroy() |
| 230 */ | 230 */ |
| 231 GaimPlugin *gaim_plugin_probe(const char *filename); | 231 PurplePlugin *purple_plugin_probe(const char *filename); |
| 232 | 232 |
| 233 /** | 233 /** |
| 234 * Registers a plugin and prepares it for loading. | 234 * Registers a plugin and prepares it for loading. |
| 235 * | 235 * |
| 236 * This shouldn't be called by anything but the internal module code. | 236 * This shouldn't be called by anything but the internal module code. |
| 237 * Plugins should use the GAIM_INIT_PLUGIN() macro to register themselves | 237 * Plugins should use the PURPLE_INIT_PLUGIN() macro to register themselves |
| 238 * with the core. | 238 * with the core. |
| 239 * | 239 * |
| 240 * @param plugin The plugin to register. | 240 * @param plugin The plugin to register. |
| 241 * | 241 * |
| 242 * @return @c TRUE if the plugin was registered successfully. Otherwise | 242 * @return @c TRUE if the plugin was registered successfully. Otherwise |
| 243 * @c FALSE is returned (this happens if the plugin does not contain | 243 * @c FALSE is returned (this happens if the plugin does not contain |
| 244 * the necessary information). | 244 * the necessary information). |
| 245 */ | 245 */ |
| 246 gboolean gaim_plugin_register(GaimPlugin *plugin); | 246 gboolean purple_plugin_register(PurplePlugin *plugin); |
| 247 | 247 |
| 248 /** | 248 /** |
| 249 * Attempts to load a previously probed plugin. | 249 * Attempts to load a previously probed plugin. |
| 250 * | 250 * |
| 251 * @param plugin The plugin to load. | 251 * @param plugin The plugin to load. |
| 252 * | 252 * |
| 253 * @return @c TRUE if successful, or @c FALSE otherwise. | 253 * @return @c TRUE if successful, or @c FALSE otherwise. |
| 254 * | 254 * |
| 255 * @see gaim_plugin_reload() | 255 * @see purple_plugin_reload() |
| 256 * @see gaim_plugin_unload() | 256 * @see purple_plugin_unload() |
| 257 */ | 257 */ |
| 258 gboolean gaim_plugin_load(GaimPlugin *plugin); | 258 gboolean purple_plugin_load(PurplePlugin *plugin); |
| 259 | 259 |
| 260 /** | 260 /** |
| 261 * Unloads the specified plugin. | 261 * Unloads the specified plugin. |
| 262 * | 262 * |
| 263 * @param plugin The plugin handle. | 263 * @param plugin The plugin handle. |
| 264 * | 264 * |
| 265 * @return @c TRUE if successful, or @c FALSE otherwise. | 265 * @return @c TRUE if successful, or @c FALSE otherwise. |
| 266 * | 266 * |
| 267 * @see gaim_plugin_load() | 267 * @see purple_plugin_load() |
| 268 * @see gaim_plugin_reload() | 268 * @see purple_plugin_reload() |
| 269 */ | 269 */ |
| 270 gboolean gaim_plugin_unload(GaimPlugin *plugin); | 270 gboolean purple_plugin_unload(PurplePlugin *plugin); |
| 271 | 271 |
| 272 /** | 272 /** |
| 273 * Reloads a plugin. | 273 * Reloads a plugin. |
| 274 * | 274 * |
| 275 * @param plugin The old plugin handle. | 275 * @param plugin The old plugin handle. |
| 276 * | 276 * |
| 277 * @return @c TRUE if successful, or @c FALSE otherwise. | 277 * @return @c TRUE if successful, or @c FALSE otherwise. |
| 278 * | 278 * |
| 279 * @see gaim_plugin_load() | 279 * @see purple_plugin_load() |
| 280 * @see gaim_plugin_unload() | 280 * @see purple_plugin_unload() |
| 281 */ | 281 */ |
| 282 gboolean gaim_plugin_reload(GaimPlugin *plugin); | 282 gboolean purple_plugin_reload(PurplePlugin *plugin); |
| 283 | 283 |
| 284 /** | 284 /** |
| 285 * Unloads a plugin and destroys the structure from memory. | 285 * Unloads a plugin and destroys the structure from memory. |
| 286 * | 286 * |
| 287 * @param plugin The plugin handle. | 287 * @param plugin The plugin handle. |
| 288 */ | 288 */ |
| 289 void gaim_plugin_destroy(GaimPlugin *plugin); | 289 void purple_plugin_destroy(PurplePlugin *plugin); |
| 290 | 290 |
| 291 /** | 291 /** |
| 292 * Returns whether or not a plugin is currently loaded. | 292 * Returns whether or not a plugin is currently loaded. |
| 293 * | 293 * |
| 294 * @param plugin The plugin. | 294 * @param plugin The plugin. |
| 295 * | 295 * |
| 296 * @return @c TRUE if loaded, or @c FALSE otherwise. | 296 * @return @c TRUE if loaded, or @c FALSE otherwise. |
| 297 */ | 297 */ |
| 298 gboolean gaim_plugin_is_loaded(const GaimPlugin *plugin); | 298 gboolean purple_plugin_is_loaded(const PurplePlugin *plugin); |
| 299 | 299 |
| 300 /** | 300 /** |
| 301 * Returns whether or not a plugin is unloadable. | 301 * Returns whether or not a plugin is unloadable. |
| 302 * | 302 * |
| 303 * If this returns @c TRUE, the plugin is guaranteed to not | 303 * If this returns @c TRUE, the plugin is guaranteed to not |
| 307 * @param plugin The plugin. | 307 * @param plugin The plugin. |
| 308 * | 308 * |
| 309 * @return @c TRUE if the plugin is known to be unloadable,\ | 309 * @return @c TRUE if the plugin is known to be unloadable,\ |
| 310 * @c FALSE otherwise | 310 * @c FALSE otherwise |
| 311 */ | 311 */ |
| 312 gboolean gaim_plugin_is_unloadable(const GaimPlugin *plugin); | 312 gboolean purple_plugin_is_unloadable(const PurplePlugin *plugin); |
| 313 | 313 |
| 314 /** | 314 /** |
| 315 * Returns a plugin's id. | 315 * Returns a plugin's id. |
| 316 * | 316 * |
| 317 * @param plugin The plugin. | 317 * @param plugin The plugin. |
| 318 * | 318 * |
| 319 * @return The plugin's id. | 319 * @return The plugin's id. |
| 320 */ | 320 */ |
| 321 const gchar *gaim_plugin_get_id(const GaimPlugin *plugin); | 321 const gchar *purple_plugin_get_id(const PurplePlugin *plugin); |
| 322 | 322 |
| 323 /** | 323 /** |
| 324 * Returns a plugin's name. | 324 * Returns a plugin's name. |
| 325 * | 325 * |
| 326 * @param plugin The plugin. | 326 * @param plugin The plugin. |
| 327 * | 327 * |
| 328 * @return THe name of the plugin, or @c NULL. | 328 * @return THe name of the plugin, or @c NULL. |
| 329 */ | 329 */ |
| 330 const gchar *gaim_plugin_get_name(const GaimPlugin *plugin); | 330 const gchar *purple_plugin_get_name(const PurplePlugin *plugin); |
| 331 | 331 |
| 332 /** | 332 /** |
| 333 * Returns a plugin's version. | 333 * Returns a plugin's version. |
| 334 * | 334 * |
| 335 * @param plugin The plugin. | 335 * @param plugin The plugin. |
| 336 * | 336 * |
| 337 * @return The plugin's version or @c NULL. | 337 * @return The plugin's version or @c NULL. |
| 338 */ | 338 */ |
| 339 const gchar *gaim_plugin_get_version(const GaimPlugin *plugin); | 339 const gchar *purple_plugin_get_version(const PurplePlugin *plugin); |
| 340 | 340 |
| 341 /** | 341 /** |
| 342 * Returns a plugin's summary. | 342 * Returns a plugin's summary. |
| 343 * | 343 * |
| 344 * @param plugin The plugin. | 344 * @param plugin The plugin. |
| 345 * | 345 * |
| 346 * @return The plugin's summary. | 346 * @return The plugin's summary. |
| 347 */ | 347 */ |
| 348 const gchar *gaim_plugin_get_summary(const GaimPlugin *plugin); | 348 const gchar *purple_plugin_get_summary(const PurplePlugin *plugin); |
| 349 | 349 |
| 350 /** | 350 /** |
| 351 * Returns a plugin's description. | 351 * Returns a plugin's description. |
| 352 * | 352 * |
| 353 * @param plugin The plugin. | 353 * @param plugin The plugin. |
| 354 * | 354 * |
| 355 * @return The plugin's description. | 355 * @return The plugin's description. |
| 356 */ | 356 */ |
| 357 const gchar *gaim_plugin_get_description(const GaimPlugin *plugin); | 357 const gchar *purple_plugin_get_description(const PurplePlugin *plugin); |
| 358 | 358 |
| 359 /** | 359 /** |
| 360 * Returns a plugin's author. | 360 * Returns a plugin's author. |
| 361 * | 361 * |
| 362 * @param plugin The plugin. | 362 * @param plugin The plugin. |
| 363 * | 363 * |
| 364 * @return The plugin's author. | 364 * @return The plugin's author. |
| 365 */ | 365 */ |
| 366 const gchar *gaim_plugin_get_author(const GaimPlugin *plugin); | 366 const gchar *purple_plugin_get_author(const PurplePlugin *plugin); |
| 367 | 367 |
| 368 /** | 368 /** |
| 369 * Returns a plugin's homepage. | 369 * Returns a plugin's homepage. |
| 370 * | 370 * |
| 371 * @param plugin The plugin. | 371 * @param plugin The plugin. |
| 372 * | 372 * |
| 373 * @return The plugin's homepage. | 373 * @return The plugin's homepage. |
| 374 */ | 374 */ |
| 375 const gchar *gaim_plugin_get_homepage(const GaimPlugin *plugin); | 375 const gchar *purple_plugin_get_homepage(const PurplePlugin *plugin); |
| 376 | 376 |
| 377 /*@}*/ | 377 /*@}*/ |
| 378 | 378 |
| 379 /**************************************************************************/ | 379 /**************************************************************************/ |
| 380 /** @name Plugin IPC API */ | 380 /** @name Plugin IPC API */ |
| 393 * @param ... The parameter types. | 393 * @param ... The parameter types. |
| 394 * | 394 * |
| 395 * @return TRUE if the function was registered successfully, or | 395 * @return TRUE if the function was registered successfully, or |
| 396 * FALSE otherwise. | 396 * FALSE otherwise. |
| 397 */ | 397 */ |
| 398 gboolean gaim_plugin_ipc_register(GaimPlugin *plugin, const char *command, | 398 gboolean purple_plugin_ipc_register(PurplePlugin *plugin, const char *command, |
| 399 GaimCallback func, | 399 PurpleCallback func, |
| 400 GaimSignalMarshalFunc marshal, | 400 PurpleSignalMarshalFunc marshal, |
| 401 GaimValue *ret_value, int num_params, ...); | 401 PurpleValue *ret_value, int num_params, ...); |
| 402 | 402 |
| 403 /** | 403 /** |
| 404 * Unregisters an IPC command in a plugin. | 404 * Unregisters an IPC command in a plugin. |
| 405 * | 405 * |
| 406 * @param plugin The plugin to unregister the command from. | 406 * @param plugin The plugin to unregister the command from. |
| 407 * @param command The name of the command. | 407 * @param command The name of the command. |
| 408 */ | 408 */ |
| 409 void gaim_plugin_ipc_unregister(GaimPlugin *plugin, const char *command); | 409 void purple_plugin_ipc_unregister(PurplePlugin *plugin, const char *command); |
| 410 | 410 |
| 411 /** | 411 /** |
| 412 * Unregisters all IPC commands in a plugin. | 412 * Unregisters all IPC commands in a plugin. |
| 413 * | 413 * |
| 414 * @param plugin The plugin to unregister the commands from. | 414 * @param plugin The plugin to unregister the commands from. |
| 415 */ | 415 */ |
| 416 void gaim_plugin_ipc_unregister_all(GaimPlugin *plugin); | 416 void purple_plugin_ipc_unregister_all(PurplePlugin *plugin); |
| 417 | 417 |
| 418 /** | 418 /** |
| 419 * Returns a list of value types used for an IPC command. | 419 * Returns a list of value types used for an IPC command. |
| 420 * | 420 * |
| 421 * @param plugin The plugin. | 421 * @param plugin The plugin. |
| 424 * @param num_params The returned number of parameters. | 424 * @param num_params The returned number of parameters. |
| 425 * @param params The returned list of parameters. | 425 * @param params The returned list of parameters. |
| 426 * | 426 * |
| 427 * @return TRUE if the command was found, or FALSE otherwise. | 427 * @return TRUE if the command was found, or FALSE otherwise. |
| 428 */ | 428 */ |
| 429 gboolean gaim_plugin_ipc_get_params(GaimPlugin *plugin, const char *command, | 429 gboolean purple_plugin_ipc_get_params(PurplePlugin *plugin, const char *command, |
| 430 GaimValue **ret_value, int *num_params, | 430 PurpleValue **ret_value, int *num_params, |
| 431 GaimValue ***params); | 431 PurpleValue ***params); |
| 432 | 432 |
| 433 /** | 433 /** |
| 434 * Executes an IPC command. | 434 * Executes an IPC command. |
| 435 * | 435 * |
| 436 * @param plugin The plugin to execute the command on. | 436 * @param plugin The plugin to execute the command on. |
| 439 * @param ... The parameters to pass. | 439 * @param ... The parameters to pass. |
| 440 * | 440 * |
| 441 * @return The return value, which will be NULL if the command doesn't | 441 * @return The return value, which will be NULL if the command doesn't |
| 442 * return a value. | 442 * return a value. |
| 443 */ | 443 */ |
| 444 void *gaim_plugin_ipc_call(GaimPlugin *plugin, const char *command, | 444 void *purple_plugin_ipc_call(PurplePlugin *plugin, const char *command, |
| 445 gboolean *ok, ...); | 445 gboolean *ok, ...); |
| 446 | 446 |
| 447 /*@}*/ | 447 /*@}*/ |
| 448 | 448 |
| 449 /**************************************************************************/ | 449 /**************************************************************************/ |
| 454 /** | 454 /** |
| 455 * Add a new directory to search for plugins | 455 * Add a new directory to search for plugins |
| 456 * | 456 * |
| 457 * @param path The new search path. | 457 * @param path The new search path. |
| 458 */ | 458 */ |
| 459 void gaim_plugins_add_search_path(const char *path); | 459 void purple_plugins_add_search_path(const char *path); |
| 460 | 460 |
| 461 /** | 461 /** |
| 462 * Unloads all loaded plugins. | 462 * Unloads all loaded plugins. |
| 463 */ | 463 */ |
| 464 void gaim_plugins_unload_all(void); | 464 void purple_plugins_unload_all(void); |
| 465 | 465 |
| 466 /** | 466 /** |
| 467 * Destroys all registered plugins. | 467 * Destroys all registered plugins. |
| 468 */ | 468 */ |
| 469 void gaim_plugins_destroy_all(void); | 469 void purple_plugins_destroy_all(void); |
| 470 | 470 |
| 471 /** | 471 /** |
| 472 * Saves the list of loaded plugins to the specified preference key | 472 * Saves the list of loaded plugins to the specified preference key |
| 473 * | 473 * |
| 474 * @param key The preference key to save the list of plugins to. | 474 * @param key The preference key to save the list of plugins to. |
| 475 */ | 475 */ |
| 476 void gaim_plugins_save_loaded(const char *key); | 476 void purple_plugins_save_loaded(const char *key); |
| 477 | 477 |
| 478 /** | 478 /** |
| 479 * Attempts to load all the plugins in the specified preference key | 479 * Attempts to load all the plugins in the specified preference key |
| 480 * that were loaded when gaim last quit. | 480 * that were loaded when purple last quit. |
| 481 * | 481 * |
| 482 * @param key The preference key containing the list of plugins. | 482 * @param key The preference key containing the list of plugins. |
| 483 */ | 483 */ |
| 484 void gaim_plugins_load_saved(const char *key); | 484 void purple_plugins_load_saved(const char *key); |
| 485 | 485 |
| 486 /** | 486 /** |
| 487 * Probes for plugins in the registered module paths. | 487 * Probes for plugins in the registered module paths. |
| 488 * | 488 * |
| 489 * @param ext The extension type to probe for, or @c NULL for all. | 489 * @param ext The extension type to probe for, or @c NULL for all. |
| 490 * | 490 * |
| 491 * @see gaim_plugin_set_probe_path() | 491 * @see purple_plugin_set_probe_path() |
| 492 */ | 492 */ |
| 493 void gaim_plugins_probe(const char *ext); | 493 void purple_plugins_probe(const char *ext); |
| 494 | 494 |
| 495 /** | 495 /** |
| 496 * Returns whether or not plugin support is enabled. | 496 * Returns whether or not plugin support is enabled. |
| 497 * | 497 * |
| 498 * @return TRUE if plugin support is enabled, or FALSE otherwise. | 498 * @return TRUE if plugin support is enabled, or FALSE otherwise. |
| 499 */ | 499 */ |
| 500 gboolean gaim_plugins_enabled(void); | 500 gboolean purple_plugins_enabled(void); |
| 501 | 501 |
| 502 /** | 502 /** |
| 503 * Registers a function that will be called when probing is finished. | 503 * Registers a function that will be called when probing is finished. |
| 504 * | 504 * |
| 505 * @param func The callback function. | 505 * @param func The callback function. |
| 506 * @param data Data to pass to the callback. | 506 * @param data Data to pass to the callback. |
| 507 */ | 507 */ |
| 508 void gaim_plugins_register_probe_notify_cb(void (*func)(void *), void *data); | 508 void purple_plugins_register_probe_notify_cb(void (*func)(void *), void *data); |
| 509 | 509 |
| 510 /** | 510 /** |
| 511 * Unregisters a function that would be called when probing is finished. | 511 * Unregisters a function that would be called when probing is finished. |
| 512 * | 512 * |
| 513 * @param func The callback function. | 513 * @param func The callback function. |
| 514 */ | 514 */ |
| 515 void gaim_plugins_unregister_probe_notify_cb(void (*func)(void *)); | 515 void purple_plugins_unregister_probe_notify_cb(void (*func)(void *)); |
| 516 | 516 |
| 517 /** | 517 /** |
| 518 * Registers a function that will be called when a plugin is loaded. | 518 * Registers a function that will be called when a plugin is loaded. |
| 519 * | 519 * |
| 520 * @param func The callback function. | 520 * @param func The callback function. |
| 521 * @param data Data to pass to the callback. | 521 * @param data Data to pass to the callback. |
| 522 */ | 522 */ |
| 523 void gaim_plugins_register_load_notify_cb(void (*func)(GaimPlugin *, void *), | 523 void purple_plugins_register_load_notify_cb(void (*func)(PurplePlugin *, void *), |
| 524 void *data); | 524 void *data); |
| 525 | 525 |
| 526 /** | 526 /** |
| 527 * Unregisters a function that would be called when a plugin is loaded. | 527 * Unregisters a function that would be called when a plugin is loaded. |
| 528 * | 528 * |
| 529 * @param func The callback function. | 529 * @param func The callback function. |
| 530 */ | 530 */ |
| 531 void gaim_plugins_unregister_load_notify_cb(void (*func)(GaimPlugin *, void *)); | 531 void purple_plugins_unregister_load_notify_cb(void (*func)(PurplePlugin *, void *)); |
| 532 | 532 |
| 533 /** | 533 /** |
| 534 * Registers a function that will be called when a plugin is unloaded. | 534 * Registers a function that will be called when a plugin is unloaded. |
| 535 * | 535 * |
| 536 * @param func The callback function. | 536 * @param func The callback function. |
| 537 * @param data Data to pass to the callback. | 537 * @param data Data to pass to the callback. |
| 538 */ | 538 */ |
| 539 void gaim_plugins_register_unload_notify_cb(void (*func)(GaimPlugin *, void *), | 539 void purple_plugins_register_unload_notify_cb(void (*func)(PurplePlugin *, void *), |
| 540 void *data); | 540 void *data); |
| 541 | 541 |
| 542 /** | 542 /** |
| 543 * Unregisters a function that would be called when a plugin is unloaded. | 543 * Unregisters a function that would be called when a plugin is unloaded. |
| 544 * | 544 * |
| 545 * @param func The callback function. | 545 * @param func The callback function. |
| 546 */ | 546 */ |
| 547 void gaim_plugins_unregister_unload_notify_cb(void (*func)(GaimPlugin *, | 547 void purple_plugins_unregister_unload_notify_cb(void (*func)(PurplePlugin *, |
| 548 void *)); | 548 void *)); |
| 549 | 549 |
| 550 /** | 550 /** |
| 551 * Finds a plugin with the specified name. | 551 * Finds a plugin with the specified name. |
| 552 * | 552 * |
| 553 * @param name The plugin name. | 553 * @param name The plugin name. |
| 554 * | 554 * |
| 555 * @return The plugin if found, or @c NULL if not found. | 555 * @return The plugin if found, or @c NULL if not found. |
| 556 */ | 556 */ |
| 557 GaimPlugin *gaim_plugins_find_with_name(const char *name); | 557 PurplePlugin *purple_plugins_find_with_name(const char *name); |
| 558 | 558 |
| 559 /** | 559 /** |
| 560 * Finds a plugin with the specified filename (filename with a path). | 560 * Finds a plugin with the specified filename (filename with a path). |
| 561 * | 561 * |
| 562 * @param filename The plugin filename. | 562 * @param filename The plugin filename. |
| 563 * | 563 * |
| 564 * @return The plugin if found, or @c NULL if not found. | 564 * @return The plugin if found, or @c NULL if not found. |
| 565 */ | 565 */ |
| 566 GaimPlugin *gaim_plugins_find_with_filename(const char *filename); | 566 PurplePlugin *purple_plugins_find_with_filename(const char *filename); |
| 567 | 567 |
| 568 /** | 568 /** |
| 569 * Finds a plugin with the specified basename (filename without a path). | 569 * Finds a plugin with the specified basename (filename without a path). |
| 570 * | 570 * |
| 571 * @param basename The plugin basename. | 571 * @param basename The plugin basename. |
| 572 * | 572 * |
| 573 * @return The plugin if found, or @c NULL if not found. | 573 * @return The plugin if found, or @c NULL if not found. |
| 574 */ | 574 */ |
| 575 GaimPlugin *gaim_plugins_find_with_basename(const char *basename); | 575 PurplePlugin *purple_plugins_find_with_basename(const char *basename); |
| 576 | 576 |
| 577 /** | 577 /** |
| 578 * Finds a plugin with the specified plugin ID. | 578 * Finds a plugin with the specified plugin ID. |
| 579 * | 579 * |
| 580 * @param id The plugin ID. | 580 * @param id The plugin ID. |
| 581 * | 581 * |
| 582 * @return The plugin if found, or @c NULL if not found. | 582 * @return The plugin if found, or @c NULL if not found. |
| 583 */ | 583 */ |
| 584 GaimPlugin *gaim_plugins_find_with_id(const char *id); | 584 PurplePlugin *purple_plugins_find_with_id(const char *id); |
| 585 | 585 |
| 586 /** | 586 /** |
| 587 * Returns a list of all loaded plugins. | 587 * Returns a list of all loaded plugins. |
| 588 * | 588 * |
| 589 * @return A list of all loaded plugins. | 589 * @return A list of all loaded plugins. |
| 590 */ | 590 */ |
| 591 GList *gaim_plugins_get_loaded(void); | 591 GList *purple_plugins_get_loaded(void); |
| 592 | 592 |
| 593 /** | 593 /** |
| 594 * Returns a list of all valid protocol plugins. A protocol | 594 * Returns a list of all valid protocol plugins. A protocol |
| 595 * plugin is considered invalid if it does not contain the call | 595 * plugin is considered invalid if it does not contain the call |
| 596 * to the GAIM_INIT_PLUGIN() macro, or if it was compiled | 596 * to the PURPLE_INIT_PLUGIN() macro, or if it was compiled |
| 597 * against an incompatable API version. | 597 * against an incompatable API version. |
| 598 * | 598 * |
| 599 * @return A list of all protocol plugins. | 599 * @return A list of all protocol plugins. |
| 600 */ | 600 */ |
| 601 GList *gaim_plugins_get_protocols(void); | 601 GList *purple_plugins_get_protocols(void); |
| 602 | 602 |
| 603 /** | 603 /** |
| 604 * Returns a list of all plugins, whether loaded or not. | 604 * Returns a list of all plugins, whether loaded or not. |
| 605 * | 605 * |
| 606 * @return A list of all plugins. | 606 * @return A list of all plugins. |
| 607 */ | 607 */ |
| 608 GList *gaim_plugins_get_all(void); | 608 GList *purple_plugins_get_all(void); |
| 609 | 609 |
| 610 /*@}*/ | 610 /*@}*/ |
| 611 | 611 |
| 612 /**************************************************************************/ | 612 /**************************************************************************/ |
| 613 /** @name Plugins SubSytem API */ | 613 /** @name Plugins SubSytem API */ |
| 617 /** | 617 /** |
| 618 * Returns the plugin subsystem handle. | 618 * Returns the plugin subsystem handle. |
| 619 * | 619 * |
| 620 * @return The plugin sybsystem handle. | 620 * @return The plugin sybsystem handle. |
| 621 */ | 621 */ |
| 622 void *gaim_plugins_get_handle(void); | 622 void *purple_plugins_get_handle(void); |
| 623 | 623 |
| 624 /** | 624 /** |
| 625 * Initializes the plugin subsystem | 625 * Initializes the plugin subsystem |
| 626 */ | 626 */ |
| 627 void gaim_plugins_init(void); | 627 void purple_plugins_init(void); |
| 628 | 628 |
| 629 /** | 629 /** |
| 630 * Uninitializes the plugin subsystem | 630 * Uninitializes the plugin subsystem |
| 631 */ | 631 */ |
| 632 void gaim_plugins_uninit(void); | 632 void purple_plugins_uninit(void); |
| 633 | 633 |
| 634 /*@}*/ | 634 /*@}*/ |
| 635 | 635 |
| 636 /** | 636 /** |
| 637 * Allocates and returns a new GaimPluginAction. | 637 * Allocates and returns a new PurplePluginAction. |
| 638 * | 638 * |
| 639 * @param label The description of the action to show to the user. | 639 * @param label The description of the action to show to the user. |
| 640 * @param callback The callback to call when the user selects this action. | 640 * @param callback The callback to call when the user selects this action. |
| 641 */ | 641 */ |
| 642 GaimPluginAction *gaim_plugin_action_new(const char* label, void (*callback)(GaimPluginAction *)); | 642 PurplePluginAction *purple_plugin_action_new(const char* label, void (*callback)(PurplePluginAction *)); |
| 643 | 643 |
| 644 /** | 644 /** |
| 645 * Frees a GaimPluginAction | 645 * Frees a PurplePluginAction |
| 646 * | 646 * |
| 647 * @param action The GaimPluginAction to free. | 647 * @param action The PurplePluginAction to free. |
| 648 */ | 648 */ |
| 649 void gaim_plugin_action_free(GaimPluginAction *action); | 649 void purple_plugin_action_free(PurplePluginAction *action); |
| 650 | 650 |
| 651 #ifdef __cplusplus | 651 #ifdef __cplusplus |
| 652 } | 652 } |
| 653 #endif | 653 #endif |
| 654 | 654 |
| 655 #endif /* _GAIM_PLUGIN_H_ */ | 655 #endif /* _PURPLE_PLUGIN_H_ */ |
