Mercurial > pidgin
changeset 21191:992d520224f7
merge of '6b5f1f48667171fe73de619dd8f80cacd231a2e2'
and 'c887121fe3462508e42c556378b957255e4992f1'
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Sat, 06 Oct 2007 22:59:14 +0000 |
parents | 2216c520f4bd (current diff) 34de8ef19294 (diff) |
children | 5d93e197ba44 |
files | |
diffstat | 6 files changed, 60 insertions(+), 47 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Thu Oct 04 18:14:10 2007 +0000 +++ b/ChangeLog Sat Oct 06 22:59:14 2007 +0000 @@ -8,6 +8,8 @@ libpurple: * Real usernames are now shown in the system log. + * We now honor a PURPLE_DISABLE_DEPRECATED define to allow plugins to + catch deprecated functions earlier rather than later. Pidgin: * If you alias a buddy to an alias that is already present within
--- a/libpurple/blist.h Thu Oct 04 18:14:10 2007 +0000 +++ b/libpurple/blist.h Sat Oct 06 22:59:14 2007 +0000 @@ -483,6 +483,7 @@ */ PurpleBuddy *purple_contact_get_priority_buddy(PurpleContact *contact); +#ifndef PURPLE_DISABLE_DEPRECATED /** * Sets the alias for a contact. * @@ -492,6 +493,7 @@ * @deprecated Use purple_blist_alias_contact() instead. */ void purple_contact_set_alias(PurpleContact *contact, const char *alias); +#endif /** * Gets the alias for a contact.
--- a/libpurple/notify.h Thu Oct 04 18:14:10 2007 +0000 +++ b/libpurple/notify.h Sat Oct 06 22:59:14 2007 +0000 @@ -290,7 +290,7 @@ */ void purple_notify_searchresults_row_add(PurpleNotifySearchResults *results, GList *row); - +#ifndef PURPLE_DISABLE_DEPRECATED /** * Returns a number of the rows in the search results object. * @@ -309,7 +309,9 @@ * @return Number of the result rows. */ guint purple_notify_searchresults_get_rows_count(PurpleNotifySearchResults *results); +#endif +#ifndef PURPLE_DISABLE_DEPRECATED /** * Returns a number of the columns in the search results object. * @@ -328,7 +330,9 @@ * @return Number of the columns. */ guint purple_notify_searchresults_get_columns_count(PurpleNotifySearchResults *results); +#endif +#ifndef PURPLE_DISABLE_DEPRECATED /** * Returns a row of the results from the search results object. * @@ -349,7 +353,9 @@ */ GList *purple_notify_searchresults_row_get(PurpleNotifySearchResults *results, unsigned int row_id); +#endif +#ifndef PURPLE_DISABLE_DEPRECATED /** * Returns a title of the search results object's column. * @@ -368,6 +374,7 @@ */ char *purple_notify_searchresults_column_get_title(PurpleNotifySearchResults *results, unsigned int column_id); +#endif /*@}*/
--- a/libpurple/plugin.c Thu Oct 04 18:14:10 2007 +0000 +++ b/libpurple/plugin.c Sat Oct 06 22:59:14 2007 +0000 @@ -60,11 +60,6 @@ static GList *plugin_loaders = NULL; #endif -/* - * TODO: I think the intention was to allow multiple load and unload - * callback functions. Perhaps using a GList instead of a - * pointer to a single function. - */ static void (*probe_cb)(void *) = NULL; static void *probe_cb_data = NULL; static void (*load_cb)(PurplePlugin *, void *) = NULL; @@ -254,7 +249,6 @@ * plugins being added to the global name space. * * G_MODULE_BIND_LOCAL was added in glib 2.3.3. - * TODO: I guess there's nothing we can do about that? */ #if GLIB_CHECK_VERSION(2,3,3) plugin->handle = g_module_open(filename, G_MODULE_BIND_LOCAL); @@ -625,7 +619,6 @@ plugin->loaded = TRUE; - /* TODO */ if (load_cb != NULL) load_cb(plugin, load_cb_data); @@ -643,29 +636,22 @@ { #ifdef PURPLE_PLUGINS GList *l; + GList *ll; g_return_val_if_fail(plugin != NULL, FALSE); - - loaded_plugins = g_list_remove(loaded_plugins, plugin); - if ((plugin->info != NULL) && PURPLE_IS_PROTOCOL_PLUGIN(plugin)) - protocol_plugins = g_list_remove(protocol_plugins, plugin); - g_return_val_if_fail(purple_plugin_is_loaded(plugin), FALSE); purple_debug_info("plugins", "Unloading plugin %s\n", plugin->info->name); - /* cancel any pending dialogs the plugin has */ - purple_request_close_with_handle(plugin); - purple_notify_close_with_handle(plugin); - - plugin->loaded = FALSE; - /* Unload all plugins that depend on this plugin. */ - while ((l = plugin->dependent_plugins) != NULL) - { + for (l = plugin->dependent_plugins, l != NULL, l = ll) { const char * dep_name = (const char *)l->data; PurplePlugin *dep_plugin; + /* Store a pointer to the next element in the list. + * This is because we'll be modifying this list in the loop. */ + ll = l->next; + dep_plugin = purple_plugins_find_with_id(dep_name); if (dep_plugin != NULL && purple_plugin_is_loaded(dep_plugin)) @@ -678,29 +664,22 @@ _(dep_plugin->info->name)); purple_notify_error(NULL, NULL, - _("There were errors unloading the plugin."), tmp); + _("There were errors unloading the plugin."), tmp); g_free(tmp); + + return FALSE; + } + else + { + plugin->dependent_plugins = g_list_remove(plugin->dependent_plugins, dep_name); } } } - /* Remove this plugin from each dependency's dependent_plugins list. */ - for (l = plugin->info->dependencies; l != NULL; l = l->next) - { - const char *dep_name = (const char *)l->data; - PurplePlugin *dependency; - - dependency = purple_plugins_find_with_id(dep_name); - - if (dependency != NULL) - dependency->dependent_plugins = g_list_remove(dependency->dependent_plugins, plugin->info->id); - else - purple_debug_error("plugins", "Unable to remove from dependency list for %s\n", dep_name); - } - if (plugin->native_plugin) { if (plugin->info->unload != NULL) - plugin->info->unload(plugin); + if (!plugin->info->unload(plugin)) + return FALSE; if (plugin->info->type == PURPLE_PLUGIN_PROTOCOL) { PurplePluginProtocolInfo *prpl_info; @@ -724,8 +703,7 @@ prpl_info->protocol_options = NULL; } } - } - else { + } else { PurplePlugin *loader; PurplePluginLoaderInfo *loader_info; @@ -737,13 +715,22 @@ loader_info = PURPLE_PLUGIN_LOADER_INFO(loader); if (loader_info->unload != NULL) - loader_info->unload(plugin); + if (!loader_info->unload(plugin)) + return FALSE; } + /* cancel any pending dialogs the plugin has */ + purple_request_close_with_handle(plugin); + purple_notify_close_with_handle(plugin); + purple_signals_disconnect_by_handle(plugin); purple_plugin_ipc_unregister_all(plugin); - /* TODO */ + loaded_plugins = g_list_remove(loaded_plugins, plugin); + if ((plugin->info != NULL) && PURPLE_IS_PROTOCOL_PLUGIN(plugin)) + protocol_plugins = g_list_remove(protocol_plugins, plugin); + plugin->loaded = FALSE; + if (unload_cb != NULL) unload_cb(plugin, unload_cb_data); @@ -1391,6 +1378,7 @@ if (probe_cb != NULL) probe_cb(probe_cb_data); + #endif /* PURPLE_PLUGINS */ } @@ -1464,7 +1452,6 @@ void purple_plugins_register_probe_notify_cb(void (*func)(void *), void *data) { - /* TODO */ probe_cb = func; probe_cb_data = data; } @@ -1472,7 +1459,6 @@ void purple_plugins_unregister_probe_notify_cb(void (*func)(void *)) { - /* TODO */ probe_cb = NULL; probe_cb_data = NULL; } @@ -1481,7 +1467,6 @@ purple_plugins_register_load_notify_cb(void (*func)(PurplePlugin *, void *), void *data) { - /* TODO */ load_cb = func; load_cb_data = data; } @@ -1489,7 +1474,6 @@ void purple_plugins_unregister_load_notify_cb(void (*func)(PurplePlugin *, void *)) { - /* TODO */ load_cb = NULL; load_cb_data = NULL; } @@ -1498,7 +1482,6 @@ purple_plugins_register_unload_notify_cb(void (*func)(PurplePlugin *, void *), void *data) { - /* TODO */ unload_cb = func; unload_cb_data = data; } @@ -1506,7 +1489,6 @@ void purple_plugins_unregister_unload_notify_cb(void (*func)(PurplePlugin *, void *)) { - /* TODO */ unload_cb = NULL; unload_cb_data = NULL; }
--- a/libpurple/plugin.h Thu Oct 04 18:14:10 2007 +0000 +++ b/libpurple/plugin.h Sat Oct 06 22:59:14 2007 +0000 @@ -526,53 +526,71 @@ */ gboolean purple_plugins_enabled(void); +#ifndef PURPLE_DISABLE_DEPRECATED /** * Registers a function that will be called when probing is finished. * * @param func The callback function. * @param data Data to pass to the callback. + * @deprecated If you need this, ask for a plugin-probe signal to be added. */ void purple_plugins_register_probe_notify_cb(void (*func)(void *), void *data); +#endif +#ifndef PURPLE_DISABLE_DEPRECATED /** * Unregisters a function that would be called when probing is finished. * * @param func The callback function. + * @deprecated If you need this, ask for a plugin-probe signal to be added. */ void purple_plugins_unregister_probe_notify_cb(void (*func)(void *)); +#endif +#ifndef PURPLE_DISABLE_DEPRECATED /** * Registers a function that will be called when a plugin is loaded. * * @param func The callback function. * @param data Data to pass to the callback. + * @deprecated Use the plugin-load signal instead. */ void purple_plugins_register_load_notify_cb(void (*func)(PurplePlugin *, void *), void *data); +#endif +#ifndef PURPLE_DISABLE_DEPRECATED /** * Unregisters a function that would be called when a plugin is loaded. * * @param func The callback function. + * @deprecated Use the plugin-load signal instead. */ void purple_plugins_unregister_load_notify_cb(void (*func)(PurplePlugin *, void *)); +#endif +#ifndef PURPLE_DISABLE_DEPRECATED /** * Registers a function that will be called when a plugin is unloaded. * * @param func The callback function. * @param data Data to pass to the callback. + * @deprecated Use the plugin-unload signal instead. */ void purple_plugins_register_unload_notify_cb(void (*func)(PurplePlugin *, void *), void *data); +#endif +#ifndef PURPLE_DISABLE_DEPRECATED /** * Unregisters a function that would be called when a plugin is unloaded. * * @param func The callback function. + * @deprecated Use the plugin-unload signal instead. */ void purple_plugins_unregister_unload_notify_cb(void (*func)(PurplePlugin *, void *)); +#endif /** * Finds a plugin with the specified name.
--- a/libpurple/sslconn.h Thu Oct 04 18:14:10 2007 +0000 +++ b/libpurple/sslconn.h Sat Oct 06 22:59:14 2007 +0000 @@ -185,6 +185,7 @@ PurpleSslErrorFunction error_func, void *data); +#ifndef PURPLE_DISABLE_DEPRECATED /** * Makes a SSL connection using an already open file descriptor. * @@ -202,6 +203,7 @@ PurpleSslInputFunction func, PurpleSslErrorFunction error_func, void *data); +#endif /** * Makes a SSL connection using an already open file descriptor.