/soc/2013/ankitkv/gobjectification: 64c551f21d5d: purple_plugin_...

Ankit Vani a at nevitus.org
Fri Aug 9 12:48:34 EDT 2013


Changeset: 64c551f21d5dc4c047c687ca60b9d77b51169ca3
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-08-09 22:17 +0530
Branch:	 soc.2013.gobjectification.plugins
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/64c551f21d5d

Description:

purple_plugin_get_error() returns a const char*, and gives the correct error if plugin does not return a PurplePluginInfo

diffstat:

 libpurple/plugins.c |  16 +++++-----------
 libpurple/plugins.h |   2 +-
 2 files changed, 6 insertions(+), 12 deletions(-)

diffs (52 lines):

diff --git a/libpurple/plugins.c b/libpurple/plugins.c
--- a/libpurple/plugins.c
+++ b/libpurple/plugins.c
@@ -82,13 +82,6 @@ purple_plugin_load(PurplePlugin *plugin)
 	if (purple_plugin_is_loaded(plugin))
 		return TRUE;
 
-	if (!purple_plugin_get_info(plugin)) {
-		purple_debug_error("plugins",
-				"Failed to load plugin %s: Plugin does not return a PluginInfo",
-				purple_plugin_get_filename(plugin));
-		return FALSE;
-	}
-
 	if (!purple_plugin_is_loadable(plugin)) {
 		purple_debug_error("plugins", "Failed to load plugin %s: %s",
 				purple_plugin_get_filename(plugin),
@@ -319,7 +312,7 @@ purple_plugin_is_loadable(const PurplePl
 	return priv->loadable;
 }
 
-gchar *
+const gchar *
 purple_plugin_get_error(const PurplePlugin *plugin)
 {
 	PurplePluginInfoPrivate *priv;
@@ -328,9 +321,10 @@ purple_plugin_get_error(const PurplePlug
 
 	priv = PURPLE_PLUGIN_INFO_GET_PRIVATE(purple_plugin_get_info(plugin));
 
-	g_return_val_if_fail(priv != NULL, NULL);
-
-	return priv->error;
+	if (priv)
+		return priv->error;
+	else
+		return _("This plugin does not return a PurplePluginInfo.");
 }
 
 GSList *
diff --git a/libpurple/plugins.h b/libpurple/plugins.h
--- a/libpurple/plugins.h
+++ b/libpurple/plugins.h
@@ -342,7 +342,7 @@ gboolean purple_plugin_is_loadable(const
  *
  * @return The reason why the plugin is not loadable.
  */
-gchar *purple_plugin_get_error(const PurplePlugin *plugin);
+const gchar *purple_plugin_get_error(const PurplePlugin *plugin);
 
 /**
  * Returns a list of plugins that depend on a particular plugin.



More information about the Commits mailing list