29#ifndef _PURPLE_PLUGIN_H_
30#define _PURPLE_PLUGIN_H_
65#define PURPLE_PRIORITY_DEFAULT 0
66#define PURPLE_PRIORITY_HIGHEST 9999
67#define PURPLE_PRIORITY_LOWEST -9999
69#define PURPLE_PLUGIN_FLAG_INVISIBLE 0x01
71#define PURPLE_PLUGIN_MAGIC 5
81 unsigned int major_version;
82 unsigned int minor_version;
124 void (*_purple_reserved1)(void);
125 void (*_purple_reserved2)(void);
126 void (*_purple_reserved3)(void);
127 void (*_purple_reserved4)(void);
142 void (*_purple_reserved1)(void);
143 void (*_purple_reserved2)(void);
144 void (*_purple_reserved3)(void);
145 void (*_purple_reserved4)(void);
164 void (*_purple_reserved1)(void);
165 void (*_purple_reserved2)(void);
166 void (*_purple_reserved3)(void);
167 void (*_purple_reserved4)(void);
170#define PURPLE_PLUGIN_LOADER_INFO(plugin) \
171 ((PurplePluginLoaderInfo *)(plugin)->info->extra_info)
174 PurplePluginPrefFrame *(*get_plugin_pref_frame)(
PurplePlugin *plugin);
179 void (*_purple_reserved1)(void);
180 void (*_purple_reserved2)(void);
181 void (*_purple_reserved3)(void);
182 void (*_purple_reserved4)(void);
185#define PURPLE_PLUGIN_HAS_PREF_FRAME(plugin) \
186 ((plugin)->info != NULL && (plugin)->info->prefs_info != NULL)
188#define PURPLE_PLUGIN_UI_INFO(plugin) \
189 ((PurplePluginUiInfo*)(plugin)->info->prefs_info)
209#define PURPLE_PLUGIN_HAS_ACTIONS(plugin) \
210 ((plugin)->info != NULL && (plugin)->info->actions != NULL)
212#define PURPLE_PLUGIN_ACTIONS(plugin, context) \
213 (PURPLE_PLUGIN_HAS_ACTIONS(plugin)? \
214 (plugin)->info->actions(plugin, context): NULL)
220#if !defined(PURPLE_PLUGINS) || defined(PURPLE_STATIC_PRPL)
221# define _FUNC_NAME(x) purple_init_##x##_plugin
222# define PURPLE_INIT_PLUGIN(pluginname, initfunc, plugininfo) \
223 gboolean _FUNC_NAME(pluginname)(void);\
224 gboolean _FUNC_NAME(pluginname)(void) { \
225 PurplePlugin *plugin = purple_plugin_new(TRUE, NULL); \
226 plugin->info = &(plugininfo); \
227 initfunc((plugin)); \
228 purple_plugin_load((plugin)); \
229 return purple_plugin_register(plugin); \
232# define PURPLE_INIT_PLUGIN(pluginname, initfunc, plugininfo) \
233 G_MODULE_EXPORT gboolean purple_init_plugin(PurplePlugin *plugin); \
234 G_MODULE_EXPORT gboolean purple_init_plugin(PurplePlugin *plugin) { \
235 plugin->info = &(plugininfo); \
236 initfunc((plugin)); \
237 return purple_plugin_register(plugin); \
453 PurpleSignalMarshalFunc marshal,
569#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_PLUGIN_C_)
580#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_PLUGIN_C_)
590#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_PLUGIN_C_)
602#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_PLUGIN_C_)
612#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_PLUGIN_C_)
624#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_PLUGIN_C_)
PurplePlugin * purple_plugin_probe(const char *filename)
Probes a plugin, retrieving the information on it and adding it to the list of available plugins.
const gchar * purple_plugin_get_name(const PurplePlugin *plugin)
Returns a plugin's name.
void purple_plugins_unload(PurplePluginType type)
Unloads all plugins of a specific type.
PurplePlugin * purple_plugins_find_with_id(const char *id)
Finds a plugin with the specified plugin ID.
PurplePluginType
Plugin types.
@ PURPLE_PLUGIN_STANDARD
Standard plugin.
@ PURPLE_PLUGIN_PROTOCOL
Protocol plugin.
@ PURPLE_PLUGIN_UNKNOWN
Unknown type.
@ PURPLE_PLUGIN_LOADER
Loader plugin.
void * purple_plugin_ipc_call(PurplePlugin *plugin, const char *command, gboolean *ok,...)
Executes an IPC command.
void purple_plugins_uninit(void)
Uninitializes the plugin subsystem.
gboolean purple_plugin_register(PurplePlugin *plugin)
Registers a plugin and prepares it for loading.
gboolean purple_plugins_enabled(void)
Returns whether or not plugin support is enabled.
gboolean purple_plugin_unload(PurplePlugin *plugin)
Unloads the specified plugin.
PurplePluginAction * purple_plugin_action_new(const char *label, void(*callback)(PurplePluginAction *))
Allocates and returns a new PurplePluginAction.
void purple_plugin_ipc_unregister(PurplePlugin *plugin, const char *command)
Unregisters an IPC command in a plugin.
void purple_plugins_load_saved(const char *key)
Attempts to load all the plugins in the specified preference key that were loaded when purple last qu...
const gchar * purple_plugin_get_version(const PurplePlugin *plugin)
Returns a plugin's version.
gboolean purple_plugin_reload(PurplePlugin *plugin)
Reloads a plugin.
PurplePlugin * purple_plugins_find_with_filename(const char *filename)
Finds a plugin with the specified filename (filename with a path).
gboolean purple_plugin_ipc_get_params(PurplePlugin *plugin, const char *command, PurpleValue **ret_value, int *num_params, PurpleValue ***params)
Returns a list of value types used for an IPC command.
GList * purple_plugins_get_all(void)
Returns a list of all plugins, whether loaded or not.
const gchar * purple_plugin_get_author(const PurplePlugin *plugin)
Returns a plugin's author.
void purple_plugins_probe(const char *ext)
Probes for plugins in the registered module paths.
void purple_plugin_ipc_unregister_all(PurplePlugin *plugin)
Unregisters all IPC commands in a plugin.
gboolean purple_plugin_ipc_register(PurplePlugin *plugin, const char *command, PurpleCallback func, PurpleSignalMarshalFunc marshal, PurpleValue *ret_value, int num_params,...)
Registers an IPC command in a plugin.
gboolean purple_plugin_load(PurplePlugin *plugin)
Attempts to load a previously probed plugin.
void purple_plugins_unregister_probe_notify_cb(void(*func)(void *))
Unregisters a function that would be called when probing is finished.
GList * purple_plugins_get_search_paths(void)
Returns a list of plugin search paths.
const gchar * purple_plugin_get_summary(const PurplePlugin *plugin)
Returns a plugin's summary.
void purple_plugin_action_free(PurplePluginAction *action)
Frees a PurplePluginAction.
void * purple_plugins_get_handle(void)
Returns the plugin subsystem handle.
void purple_plugins_init(void)
Initializes the plugin subsystem.
void purple_plugins_unregister_unload_notify_cb(void(*func)(PurplePlugin *, void *))
Unregisters a function that would be called when a plugin is unloaded.
void purple_plugins_destroy_all(void)
Destroys all registered plugins.
int PurplePluginPriority
Plugin priority.
const gchar * purple_plugin_get_homepage(const PurplePlugin *plugin)
Returns a plugin's homepage.
gboolean purple_plugin_is_unloadable(const PurplePlugin *plugin)
Returns whether or not a plugin is unloadable.
void purple_plugins_unregister_load_notify_cb(void(*func)(PurplePlugin *, void *))
Unregisters a function that would be called when a plugin is loaded.
void purple_plugin_destroy(PurplePlugin *plugin)
Unloads a plugin and destroys the structure from memory.
void purple_plugins_unload_all(void)
Unloads all loaded plugins.
void purple_plugin_disable(PurplePlugin *plugin)
Disable a plugin.
PurplePlugin * purple_plugins_find_with_basename(const char *basename)
Finds a plugin with the specified basename (filename without a path).
PurplePlugin * purple_plugin_new(gboolean native, const char *path)
Creates a new plugin structure.
void purple_plugins_register_load_notify_cb(void(*func)(PurplePlugin *, void *), void *data)
Registers a function that will be called when a plugin is loaded.
const gchar * purple_plugin_get_description(const PurplePlugin *plugin)
Returns a plugin's description.
void purple_plugins_add_search_path(const char *path)
Add a new directory to search for plugins.
void purple_plugins_register_probe_notify_cb(void(*func)(void *), void *data)
Registers a function that will be called when probing is finished.
const gchar * purple_plugin_get_id(const PurplePlugin *plugin)
Returns a plugin's id.
GList * purple_plugins_get_loaded(void)
Returns a list of all loaded plugins.
PurplePlugin * purple_plugins_find_with_name(const char *name)
Finds a plugin with the specified name.
gboolean purple_plugin_is_loaded(const PurplePlugin *plugin)
Returns whether or not a plugin is currently loaded.
GList * purple_plugins_get_protocols(void)
Returns a list of all valid protocol plugins.
void purple_plugins_register_unload_notify_cb(void(*func)(PurplePlugin *, void *), void *data)
Registers a function that will be called when a plugin is unloaded.
void purple_plugins_save_loaded(const char *key)
Saves the list of loaded plugins to the specified preference key.
A wrapper for a type, subtype, and specific type of value.
The structure used in the actions member of PurplePluginInfo.
PurplePlugin * plugin
set to the owning plugin
gpointer context
NULL for plugin actions menu, set to the PurpleConnection for account actions menu.
Detailed information about a plugin.
PurplePluginUiInfo * prefs_info
Used by any plugin to display preferences.
void * ui_info
Used only by UI-specific plugins to build a preference screen with a custom UI.
gboolean(* load)(PurplePlugin *plugin)
If a plugin defines a 'load' function, and it returns FALSE, then the plugin will not be loaded.
Extra information for loader plugins.
PurplePluginPrefFrame * frame
Reserved.
char * path
The path to the plugin.
gboolean loaded
The loaded state.
PurplePluginInfo * info
The plugin information.
void * handle
The module handle.
gboolean unloadable
Unloadable
GList * dependent_plugins
Plugins depending on this.
void * extra
Plugin-specific data.
gboolean native_plugin
Native C plugin.