Frameworks/libpurple.framework/Versions/0.6.2/Headers/plugin.h
author Zachary West <zacw@adium.im>
Fri Aug 21 13:25:11 2009 -0700 (2009-08-21)
changeset 2592 e8d15275025e
parent 2535 Frameworks/libpurple.framework/Versions/0.6.0/Headers/plugin.h@39c3c161de14
permissions -rw-r--r--
im.pidgin.adium.1-4 at 267c6165e02e34318a1823960bd04c0639952f73
     1 /**
     2  * @file plugin.h Plugin API
     3  * @ingroup core
     4  * @see @ref plugin-signals
     5  * @see @ref plugin-ids
     6  * @see @ref plugin-i18n
     7  */
     8 
     9 /* purple
    10  *
    11  * Purple is the legal property of its developers, whose names are too numerous
    12  * to list here.  Please refer to the COPYRIGHT file distributed with this
    13  * source distribution.
    14  *
    15  * This program is free software; you can redistribute it and/or modify
    16  * it under the terms of the GNU General Public License as published by
    17  * the Free Software Foundation; either version 2 of the License, or
    18  * (at your option) any later version.
    19  *
    20  * This program is distributed in the hope that it will be useful,
    21  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    22  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    23  * GNU General Public License for more details.
    24  *
    25  * You should have received a copy of the GNU General Public License
    26  * along with this program; if not, write to the Free Software
    27  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
    28  */
    29 #ifndef _PURPLE_PLUGIN_H_
    30 #define _PURPLE_PLUGIN_H_
    31 
    32 #include <glib.h>
    33 #include <gmodule.h>
    34 #include "signals.h"
    35 #include "value.h"
    36 
    37 /** @copydoc _PurplePlugin */
    38 typedef struct _PurplePlugin           PurplePlugin;
    39 /** @copydoc _PurplePluginInfo */
    40 typedef struct _PurplePluginInfo       PurplePluginInfo;
    41 /** @copydoc _PurplePluginUiInfo */
    42 typedef struct _PurplePluginUiInfo     PurplePluginUiInfo;
    43 /** @copydoc _PurplePluginLoaderInfo */
    44 typedef struct _PurplePluginLoaderInfo PurplePluginLoaderInfo;
    45 
    46 /** @copydoc _PurplePluginAction */
    47 typedef struct _PurplePluginAction     PurplePluginAction;
    48 
    49 typedef int PurplePluginPriority; /**< Plugin priority. */
    50 
    51 #include "pluginpref.h"
    52 
    53 /**
    54  * Plugin types.
    55  */
    56 typedef enum
    57 {
    58 	PURPLE_PLUGIN_UNKNOWN  = -1,  /**< Unknown type.    */
    59 	PURPLE_PLUGIN_STANDARD = 0,   /**< Standard plugin. */
    60 	PURPLE_PLUGIN_LOADER,         /**< Loader plugin.   */
    61 	PURPLE_PLUGIN_PROTOCOL        /**< Protocol plugin. */
    62 
    63 } PurplePluginType;
    64 
    65 #define PURPLE_PRIORITY_DEFAULT     0
    66 #define PURPLE_PRIORITY_HIGHEST  9999
    67 #define PURPLE_PRIORITY_LOWEST  -9999
    68 
    69 #define PURPLE_PLUGIN_FLAG_INVISIBLE 0x01
    70 
    71 #define PURPLE_PLUGIN_MAGIC 5 /* once we hit 6.0.0 I think we can remove this */
    72 
    73 /**
    74  * Detailed information about a plugin.
    75  *
    76  * This is used in the version 2.0 API and up.
    77  */
    78 struct _PurplePluginInfo
    79 {
    80 	unsigned int magic;
    81 	unsigned int major_version;
    82 	unsigned int minor_version;
    83 	PurplePluginType type;
    84 	char *ui_requirement;
    85 	unsigned long flags;
    86 	GList *dependencies;
    87 	PurplePluginPriority priority;
    88 
    89 	char *id;
    90 	char *name;
    91 	char *version;
    92 	char *summary;
    93 	char *description;
    94 	char *author;
    95 	char *homepage;
    96 
    97 	/**
    98 	 * If a plugin defines a 'load' function, and it returns FALSE,
    99 	 * then the plugin will not be loaded.
   100 	 */
   101 	gboolean (*load)(PurplePlugin *plugin);
   102 	gboolean (*unload)(PurplePlugin *plugin);
   103 	void (*destroy)(PurplePlugin *plugin);
   104 
   105 	void *ui_info; /**< Used only by UI-specific plugins to build a preference screen with a custom UI */
   106 	void *extra_info;
   107 	PurplePluginUiInfo *prefs_info; /**< Used by any plugin to display preferences.  If #ui_info has been specified, this will be ignored. */
   108 
   109 	/**
   110 	 * This callback has a different use depending on whether this
   111 	 * plugin type is PURPLE_PLUGIN_STANDARD or PURPLE_PLUGIN_PROTOCOL.
   112 	 *
   113 	 * If PURPLE_PLUGIN_STANDARD then the list of actions will show up
   114 	 * in the Tools menu, under a submenu with the name of the plugin.
   115 	 * context will be NULL.
   116 	 *
   117 	 * If PURPLE_PLUGIN_PROTOCOL then the list of actions will show up
   118 	 * in the Accounts menu, under a submenu with the name of the
   119 	 * account.  context will be set to the PurpleConnection for that
   120 	 * account.  This callback will only be called for online accounts.
   121 	 */
   122 	GList *(*actions)(PurplePlugin *plugin, gpointer context);
   123 
   124 	void (*_purple_reserved1)(void);
   125 	void (*_purple_reserved2)(void);
   126 	void (*_purple_reserved3)(void);
   127 	void (*_purple_reserved4)(void);
   128 };
   129 
   130 /**
   131  * Extra information for loader plugins.
   132  */
   133 struct _PurplePluginLoaderInfo
   134 {
   135 	GList *exts;
   136 
   137 	gboolean (*probe)(PurplePlugin *plugin);
   138 	gboolean (*load)(PurplePlugin *plugin);
   139 	gboolean (*unload)(PurplePlugin *plugin);
   140 	void     (*destroy)(PurplePlugin *plugin);
   141 
   142 	void (*_purple_reserved1)(void);
   143 	void (*_purple_reserved2)(void);
   144 	void (*_purple_reserved3)(void);
   145 	void (*_purple_reserved4)(void);
   146 };
   147 
   148 /**
   149  * A plugin handle.
   150  */
   151 struct _PurplePlugin
   152 {
   153 	gboolean native_plugin;                /**< Native C plugin.          */
   154 	gboolean loaded;                       /**< The loaded state.         */
   155 	void *handle;                          /**< The module handle.        */
   156 	char *path;                            /**< The path to the plugin.   */
   157 	PurplePluginInfo *info;                  /**< The plugin information.   */
   158 	char *error;
   159 	void *ipc_data;                        /**< IPC data.                 */
   160 	void *extra;                           /**< Plugin-specific data.     */
   161 	gboolean unloadable;                   /**< Unloadable                */
   162 	GList *dependent_plugins;              /**< Plugins depending on this */
   163 
   164 	void (*_purple_reserved1)(void);
   165 	void (*_purple_reserved2)(void);
   166 	void (*_purple_reserved3)(void);
   167 	void (*_purple_reserved4)(void);
   168 };
   169 
   170 #define PURPLE_PLUGIN_LOADER_INFO(plugin) \
   171 	((PurplePluginLoaderInfo *)(plugin)->info->extra_info)
   172 
   173 struct _PurplePluginUiInfo {
   174 	PurplePluginPrefFrame *(*get_plugin_pref_frame)(PurplePlugin *plugin);
   175 
   176 	int page_num;                                         /**< Reserved */
   177 	PurplePluginPrefFrame *frame;                           /**< Reserved */
   178 
   179 	void (*_purple_reserved1)(void);
   180 	void (*_purple_reserved2)(void);
   181 	void (*_purple_reserved3)(void);
   182 	void (*_purple_reserved4)(void);
   183 };
   184 
   185 #define PURPLE_PLUGIN_HAS_PREF_FRAME(plugin) \
   186 	((plugin)->info != NULL && (plugin)->info->prefs_info != NULL)
   187 
   188 #define PURPLE_PLUGIN_UI_INFO(plugin) \
   189 	((PurplePluginUiInfo*)(plugin)->info->prefs_info)
   190 
   191 
   192 /**
   193  * The structure used in the actions member of PurplePluginInfo
   194  */
   195 struct _PurplePluginAction {
   196 	char *label;
   197 	void (*callback)(PurplePluginAction *);
   198 
   199 	/** set to the owning plugin */
   200 	PurplePlugin *plugin;
   201 
   202 	/** NULL for plugin actions menu, set to the PurpleConnection for
   203 	    account actions menu */
   204 	gpointer context;
   205 
   206 	gpointer user_data;
   207 };
   208 
   209 #define PURPLE_PLUGIN_HAS_ACTIONS(plugin) \
   210 	((plugin)->info != NULL && (plugin)->info->actions != NULL)
   211 
   212 #define PURPLE_PLUGIN_ACTIONS(plugin, context) \
   213 	(PURPLE_PLUGIN_HAS_ACTIONS(plugin)? \
   214 	(plugin)->info->actions(plugin, context): NULL)
   215 
   216 
   217 /**
   218  * Handles the initialization of modules.
   219  */
   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); \
   230 	}
   231 #else /* PURPLE_PLUGINS  && !PURPLE_STATIC_PRPL */
   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); \
   238 	}
   239 #endif
   240 
   241 
   242 #ifdef __cplusplus
   243 extern "C" {
   244 #endif
   245 
   246 /**************************************************************************/
   247 /** @name Plugin API                                                      */
   248 /**************************************************************************/
   249 /*@{*/
   250 
   251 /**
   252  * Creates a new plugin structure.
   253  *
   254  * @param native Whether or not the plugin is native.
   255  * @param path   The path to the plugin, or @c NULL if statically compiled.
   256  *
   257  * @return A new PurplePlugin structure.
   258  */
   259 PurplePlugin *purple_plugin_new(gboolean native, const char *path);
   260 
   261 /**
   262  * Probes a plugin, retrieving the information on it and adding it to the
   263  * list of available plugins.
   264  *
   265  * @param filename The plugin's filename.
   266  *
   267  * @return The plugin handle.
   268  *
   269  * @see purple_plugin_load()
   270  * @see purple_plugin_destroy()
   271  */
   272 PurplePlugin *purple_plugin_probe(const char *filename);
   273 
   274 /**
   275  * Registers a plugin and prepares it for loading.
   276  *
   277  * This shouldn't be called by anything but the internal module code.
   278  * Plugins should use the PURPLE_INIT_PLUGIN() macro to register themselves
   279  * with the core.
   280  *
   281  * @param plugin The plugin to register.
   282  *
   283  * @return @c TRUE if the plugin was registered successfully.  Otherwise
   284  *         @c FALSE is returned (this happens if the plugin does not contain
   285  *         the necessary information).
   286  */
   287 gboolean purple_plugin_register(PurplePlugin *plugin);
   288 
   289 /**
   290  * Attempts to load a previously probed plugin.
   291  *
   292  * @param plugin The plugin to load.
   293  *
   294  * @return @c TRUE if successful, or @c FALSE otherwise.
   295  *
   296  * @see purple_plugin_reload()
   297  * @see purple_plugin_unload()
   298  */
   299 gboolean purple_plugin_load(PurplePlugin *plugin);
   300 
   301 /**
   302  * Unloads the specified plugin.
   303  *
   304  * @param plugin The plugin handle.
   305  *
   306  * @return @c TRUE if successful, or @c FALSE otherwise.
   307  *
   308  * @see purple_plugin_load()
   309  * @see purple_plugin_reload()
   310  */
   311 gboolean purple_plugin_unload(PurplePlugin *plugin);
   312 
   313 /**
   314  * Disable a plugin.
   315  *
   316  * This function adds the plugin to a list of plugins to "disable at the next
   317  * startup" by excluding said plugins from the list of plugins to save.  The
   318  * UI needs to call purple_plugins_save_loaded() after calling this for it
   319  * to have any effect.
   320  *
   321  * @since 2.3.0
   322  */
   323 void purple_plugin_disable(PurplePlugin *plugin);
   324 
   325 /**
   326  * Reloads a plugin.
   327  *
   328  * @param plugin The old plugin handle.
   329  *
   330  * @return @c TRUE if successful, or @c FALSE otherwise.
   331  *
   332  * @see purple_plugin_load()
   333  * @see purple_plugin_unload()
   334  */
   335 gboolean purple_plugin_reload(PurplePlugin *plugin);
   336 
   337 /**
   338  * Unloads a plugin and destroys the structure from memory.
   339  *
   340  * @param plugin The plugin handle.
   341  */
   342 void purple_plugin_destroy(PurplePlugin *plugin);
   343 
   344 /**
   345  * Returns whether or not a plugin is currently loaded.
   346  *
   347  * @param plugin The plugin.
   348  *
   349  * @return @c TRUE if loaded, or @c FALSE otherwise.
   350  */
   351 gboolean purple_plugin_is_loaded(const PurplePlugin *plugin);
   352 
   353 /**
   354  * Returns whether or not a plugin is unloadable.
   355  *
   356  * If this returns @c TRUE, the plugin is guaranteed to not
   357  * be loadable. However, a return value of @c FALSE does not
   358  * guarantee the plugin is loadable.
   359  *
   360  * @param plugin The plugin.
   361  *
   362  * @return @c TRUE if the plugin is known to be unloadable,\
   363  *         @c FALSE otherwise
   364  */
   365 gboolean purple_plugin_is_unloadable(const PurplePlugin *plugin);
   366 
   367 /**
   368  * Returns a plugin's id.
   369  *
   370  * @param plugin The plugin.
   371  *
   372  * @return The plugin's id.
   373  */
   374 const gchar *purple_plugin_get_id(const PurplePlugin *plugin);
   375 
   376 /**
   377  * Returns a plugin's name.
   378  *
   379  * @param plugin The plugin.
   380  *
   381  * @return THe name of the plugin, or @c NULL.
   382  */
   383 const gchar *purple_plugin_get_name(const PurplePlugin *plugin);
   384 
   385 /**
   386  * Returns a plugin's version.
   387  *
   388  * @param plugin The plugin.
   389  *
   390  * @return The plugin's version or @c NULL.
   391  */
   392 const gchar *purple_plugin_get_version(const PurplePlugin *plugin);
   393 
   394 /**
   395  * Returns a plugin's summary.
   396  *
   397  * @param plugin The plugin.
   398  *
   399  * @return The plugin's summary.
   400  */
   401 const gchar *purple_plugin_get_summary(const PurplePlugin *plugin);
   402 
   403 /**
   404  * Returns a plugin's description.
   405  *
   406  * @param plugin The plugin.
   407  *
   408  * @return The plugin's description.
   409  */
   410 const gchar *purple_plugin_get_description(const PurplePlugin *plugin);
   411 
   412 /**
   413  * Returns a plugin's author.
   414  *
   415  * @param plugin The plugin.
   416  *
   417  * @return The plugin's author.
   418  */
   419 const gchar *purple_plugin_get_author(const PurplePlugin *plugin);
   420 
   421 /**
   422  * Returns a plugin's homepage.
   423  *
   424  * @param plugin The plugin.
   425  *
   426  * @return The plugin's homepage.
   427  */
   428 const gchar *purple_plugin_get_homepage(const PurplePlugin *plugin);
   429 
   430 /*@}*/
   431 
   432 /**************************************************************************/
   433 /** @name Plugin IPC API                                                  */
   434 /**************************************************************************/
   435 /*@{*/
   436 
   437 /**
   438  * Registers an IPC command in a plugin.
   439  *
   440  * @param plugin     The plugin to register the command with.
   441  * @param command    The name of the command.
   442  * @param func       The function to execute.
   443  * @param marshal    The marshalling function.
   444  * @param ret_value  The return value type.
   445  * @param num_params The number of parameters.
   446  * @param ...        The parameter types.
   447  *
   448  * @return TRUE if the function was registered successfully, or
   449  *         FALSE otherwise.
   450  */
   451 gboolean purple_plugin_ipc_register(PurplePlugin *plugin, const char *command,
   452 								  PurpleCallback func,
   453 								  PurpleSignalMarshalFunc marshal,
   454 								  PurpleValue *ret_value, int num_params, ...);
   455 
   456 /**
   457  * Unregisters an IPC command in a plugin.
   458  *
   459  * @param plugin  The plugin to unregister the command from.
   460  * @param command The name of the command.
   461  */
   462 void purple_plugin_ipc_unregister(PurplePlugin *plugin, const char *command);
   463 
   464 /**
   465  * Unregisters all IPC commands in a plugin.
   466  *
   467  * @param plugin The plugin to unregister the commands from.
   468  */
   469 void purple_plugin_ipc_unregister_all(PurplePlugin *plugin);
   470 
   471 /**
   472  * Returns a list of value types used for an IPC command.
   473  *
   474  * @param plugin     The plugin.
   475  * @param command    The name of the command.
   476  * @param ret_value  The returned return value.
   477  * @param num_params The returned number of parameters.
   478  * @param params     The returned list of parameters.
   479  *
   480  * @return TRUE if the command was found, or FALSE otherwise.
   481  */
   482 gboolean purple_plugin_ipc_get_params(PurplePlugin *plugin, const char *command,
   483 									PurpleValue **ret_value, int *num_params,
   484 									PurpleValue ***params);
   485 
   486 /**
   487  * Executes an IPC command.
   488  *
   489  * @param plugin  The plugin to execute the command on.
   490  * @param command The name of the command.
   491  * @param ok      TRUE if the call was successful, or FALSE otherwise.
   492  * @param ...     The parameters to pass.
   493  *
   494  * @return The return value, which will be NULL if the command doesn't
   495  *         return a value.
   496  */
   497 void *purple_plugin_ipc_call(PurplePlugin *plugin, const char *command,
   498 						   gboolean *ok, ...);
   499 
   500 /*@}*/
   501 
   502 /**************************************************************************/
   503 /** @name Plugins API                                                     */
   504 /**************************************************************************/
   505 /*@{*/
   506 
   507 /**
   508  * Add a new directory to search for plugins
   509  *
   510  * @param path The new search path.
   511  */
   512 void purple_plugins_add_search_path(const char *path);
   513 
   514 /**
   515  * Returns a list of plugin search paths.
   516  *
   517  * @constreturn A list of searched paths.
   518  *
   519  * @since 2.6.0
   520  */
   521 GList *purple_plugins_get_search_paths(void);
   522 
   523 /**
   524  * Unloads all loaded plugins.
   525  */
   526 void purple_plugins_unload_all(void);
   527 
   528 /**
   529  * Unloads all plugins of a specific type.
   530  */
   531 void purple_plugins_unload(PurplePluginType type);
   532 
   533 /**
   534  * Destroys all registered plugins.
   535  */
   536 void purple_plugins_destroy_all(void);
   537 
   538 /**
   539  * Saves the list of loaded plugins to the specified preference key
   540  *
   541  * @param key The preference key to save the list of plugins to.
   542  */
   543 void purple_plugins_save_loaded(const char *key);
   544 
   545 /**
   546  * Attempts to load all the plugins in the specified preference key
   547  * that were loaded when purple last quit.
   548  *
   549  * @param key The preference key containing the list of plugins.
   550  */
   551 void purple_plugins_load_saved(const char *key);
   552 
   553 /**
   554  * Probes for plugins in the registered module paths.
   555  *
   556  * @param ext The extension type to probe for, or @c NULL for all.
   557  *
   558  * @see purple_plugin_set_probe_path()
   559  */
   560 void purple_plugins_probe(const char *ext);
   561 
   562 /**
   563  * Returns whether or not plugin support is enabled.
   564  *
   565  * @return TRUE if plugin support is enabled, or FALSE otherwise.
   566  */
   567 gboolean purple_plugins_enabled(void);
   568 
   569 #if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_PLUGIN_C_)
   570 /**
   571  * Registers a function that will be called when probing is finished.
   572  *
   573  * @param func The callback function.
   574  * @param data Data to pass to the callback.
   575  * @deprecated If you need this, ask for a plugin-probe signal to be added.
   576  */
   577 void purple_plugins_register_probe_notify_cb(void (*func)(void *), void *data);
   578 #endif
   579 
   580 #if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_PLUGIN_C_)
   581 /**
   582  * Unregisters a function that would be called when probing is finished.
   583  *
   584  * @param func The callback function.
   585  * @deprecated If you need this, ask for a plugin-probe signal to be added.
   586  */
   587 void purple_plugins_unregister_probe_notify_cb(void (*func)(void *));
   588 #endif
   589 
   590 #if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_PLUGIN_C_)
   591 /**
   592  * Registers a function that will be called when a plugin is loaded.
   593  *
   594  * @param func The callback function.
   595  * @param data Data to pass to the callback.
   596  * @deprecated Use the plugin-load signal instead.
   597  */
   598 void purple_plugins_register_load_notify_cb(void (*func)(PurplePlugin *, void *),
   599 										  void *data);
   600 #endif
   601 
   602 #if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_PLUGIN_C_)
   603 /**
   604  * Unregisters a function that would be called when a plugin is loaded.
   605  *
   606  * @param func The callback function.
   607  * @deprecated Use the plugin-load signal instead.
   608  */
   609 void purple_plugins_unregister_load_notify_cb(void (*func)(PurplePlugin *, void *));
   610 #endif
   611 
   612 #if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_PLUGIN_C_)
   613 /**
   614  * Registers a function that will be called when a plugin is unloaded.
   615  *
   616  * @param func The callback function.
   617  * @param data Data to pass to the callback.
   618  * @deprecated Use the plugin-unload signal instead.
   619  */
   620 void purple_plugins_register_unload_notify_cb(void (*func)(PurplePlugin *, void *),
   621 											void *data);
   622 #endif
   623 
   624 #if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_PLUGIN_C_)
   625 /**
   626  * Unregisters a function that would be called when a plugin is unloaded.
   627  *
   628  * @param func The callback function.
   629  * @deprecated Use the plugin-unload signal instead.
   630  */
   631 void purple_plugins_unregister_unload_notify_cb(void (*func)(PurplePlugin *,
   632 														   void *));
   633 #endif
   634 
   635 /**
   636  * Finds a plugin with the specified name.
   637  *
   638  * @param name The plugin name.
   639  *
   640  * @return The plugin if found, or @c NULL if not found.
   641  */
   642 PurplePlugin *purple_plugins_find_with_name(const char *name);
   643 
   644 /**
   645  * Finds a plugin with the specified filename (filename with a path).
   646  *
   647  * @param filename The plugin filename.
   648  *
   649  * @return The plugin if found, or @c NULL if not found.
   650  */
   651 PurplePlugin *purple_plugins_find_with_filename(const char *filename);
   652 
   653 /**
   654  * Finds a plugin with the specified basename (filename without a path).
   655  *
   656  * @param basename The plugin basename.
   657  *
   658  * @return The plugin if found, or @c NULL if not found.
   659  */
   660 PurplePlugin *purple_plugins_find_with_basename(const char *basename);
   661 
   662 /**
   663  * Finds a plugin with the specified plugin ID.
   664  *
   665  * @param id The plugin ID.
   666  *
   667  * @return The plugin if found, or @c NULL if not found.
   668  */
   669 PurplePlugin *purple_plugins_find_with_id(const char *id);
   670 
   671 /**
   672  * Returns a list of all loaded plugins.
   673  *
   674  * @constreturn A list of all loaded plugins.
   675  */
   676 GList *purple_plugins_get_loaded(void);
   677 
   678 /**
   679  * Returns a list of all valid protocol plugins.  A protocol
   680  * plugin is considered invalid if it does not contain the call
   681  * to the PURPLE_INIT_PLUGIN() macro, or if it was compiled
   682  * against an incompatable API version.
   683  *
   684  * @constreturn A list of all protocol plugins.
   685  */
   686 GList *purple_plugins_get_protocols(void);
   687 
   688 /**
   689  * Returns a list of all plugins, whether loaded or not.
   690  *
   691  * @constreturn A list of all plugins.
   692  */
   693 GList *purple_plugins_get_all(void);
   694 
   695 /*@}*/
   696 
   697 /**************************************************************************/
   698 /** @name Plugins SubSytem API                                            */
   699 /**************************************************************************/
   700 /*@{*/
   701 
   702 /**
   703  * Returns the plugin subsystem handle.
   704  *
   705  * @return The plugin sybsystem handle.
   706  */
   707 void *purple_plugins_get_handle(void);
   708 
   709 /**
   710  * Initializes the plugin subsystem
   711  */
   712 void purple_plugins_init(void);
   713 
   714 /**
   715  * Uninitializes the plugin subsystem
   716  */
   717 void purple_plugins_uninit(void);
   718 
   719 /*@}*/
   720 
   721 /**
   722  * Allocates and returns a new PurplePluginAction.
   723  *
   724  * @param label    The description of the action to show to the user.
   725  * @param callback The callback to call when the user selects this action.
   726  */
   727 PurplePluginAction *purple_plugin_action_new(const char* label, void (*callback)(PurplePluginAction *));
   728 
   729 /**
   730  * Frees a PurplePluginAction
   731  *
   732  * @param action The PurplePluginAction to free.
   733  */
   734 void purple_plugin_action_free(PurplePluginAction *action);
   735 
   736 #ifdef __cplusplus
   737 }
   738 #endif
   739 
   740 #endif /* _PURPLE_PLUGIN_H_ */