/soc/2013/ankitkv/gobjectification: 86e882c3cfdf: Refactored lib...

Ankit Vani a at nevitus.org
Sun Aug 11 10:06:06 EDT 2013


Changeset: 86e882c3cfdf6d1b9f05e3eb89374165527ec8c5
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-08-11 19:25 +0530
Branch:	 soc.2013.gobjectification.plugins
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/86e882c3cfdf

Description:

Refactored libpurple according to the changes

diffstat:

 libpurple/internal.h                     |  3 +--
 libpurple/keyring.c                      |  5 +++--
 libpurple/plugins.h                      |  3 ++-
 libpurple/plugins/ssl/ssl.c              |  7 ++++---
 libpurple/protocols/jabber/libfacebook.c |  1 +
 libpurple/protocols/jabber/libgtalk.c    |  1 +
 libpurple/protocols/jabber/libxmpp.c     |  1 +
 libpurple/protocols/null/nullprpl.c      |  1 +
 libpurple/prpl.h                         |  1 -
 libpurple/sslconn.c                      |  5 +++--
 10 files changed, 17 insertions(+), 11 deletions(-)

diffs (177 lines):

diff --git a/libpurple/internal.h b/libpurple/internal.h
--- a/libpurple/internal.h
+++ b/libpurple/internal.h
@@ -98,8 +98,6 @@
 #include <langinfo.h>
 #endif
 
-#include <gmodule.h>
-
 #ifdef PURPLE_PLUGINS
 # ifdef HAVE_DLFCN_H
 #  include <dlfcn.h>
@@ -158,6 +156,7 @@
 
 #include "accounts.h"
 #include "connection.h"
+#include "prefs.h"
 
 /* This is for the accounts code to notify the buddy icon code that
  * it's done loading.  We may want to replace this with a signal. */
diff --git a/libpurple/keyring.c b/libpurple/keyring.c
--- a/libpurple/keyring.c
+++ b/libpurple/keyring.c
@@ -33,6 +33,7 @@
 #include "debug.h"
 #include "internal.h"
 #include "dbus-maybe.h"
+#include "plugins.h"
 
 struct _PurpleKeyring
 {
@@ -1297,7 +1298,7 @@ purple_keyring_init(void)
 		if (purple_plugin_is_loaded(plugin))
 			continue;
 
-		if (purple_plugin_load(plugin))
+		if (purple_plugin_load(plugin, NULL))
 		{
 			purple_keyring_loaded_plugins = g_list_append(
 				purple_keyring_loaded_plugins, plugin);
@@ -1335,7 +1336,7 @@ purple_keyring_uninit(void)
 		PurplePlugin *plugin = PURPLE_PLUGIN(it->data);
 		if (g_list_find(purple_plugins_get_loaded(), plugin) == NULL)
 			continue;
-		purple_plugin_unload(plugin);
+		purple_plugin_unload(plugin, NULL);
 	}
 	g_list_free(purple_keyring_loaded_plugins);
 	purple_keyring_loaded_plugins = NULL;
diff --git a/libpurple/plugins.h b/libpurple/plugins.h
--- a/libpurple/plugins.h
+++ b/libpurple/plugins.h
@@ -39,6 +39,8 @@
 
 #include "version.h"
 
+#define PURPLE_PLUGINS_DOMAIN          (g_quark_from_static_string("plugins"))
+
 #ifdef PURPLE_PLUGINS
 
 #define PURPLE_TYPE_PLUGIN             GPLUGIN_TYPE_PLUGIN
@@ -69,7 +71,6 @@ typedef GPluginPluginClass PurplePluginC
 #define PURPLE_IS_PLUGIN_CLASS(klass)  G_IS_OBJECT_CLASS(klass)
 #define PURPLE_PLUGIN_GET_CLASS(obj)   G_OBJECT_GET_CLASS(obj)
 
-#define GPLUGIN_NATIVE_ABI_VERSION              0
 #define GPLUGIN_PLUGIN_INFO_FLAGS_LOAD_ON_QUERY 0
 #define GPLUGIN_PLUGIN_INFO_FLAGS_INTERNAL      0
 
diff --git a/libpurple/plugins/ssl/ssl.c b/libpurple/plugins/ssl/ssl.c
--- a/libpurple/plugins/ssl/ssl.c
+++ b/libpurple/plugins/ssl/ssl.c
@@ -50,7 +50,7 @@ probe_ssl_plugins(PurplePlugin *my_plugi
 		if (strncmp(purple_plugin_info_get_id(purple_plugin_get_info(plugin)),
 				"ssl-", 4) == 0)
 		{
-			if (purple_plugin_is_loaded(plugin) || purple_plugin_load(plugin))
+			if (purple_plugin_load(plugin, NULL))
 			{
 				ssl_plugin = plugin;
 
@@ -63,7 +63,7 @@ probe_ssl_plugins(PurplePlugin *my_plugi
 
 	if (ssl_plugin == NULL) {
 		g_set_error(error, SSL_PLUGIN_DOMAIN, 0,
-				"Could not find a plugin that implements SSL.");
+				"Could not load a plugin that implements SSL.");
 		return FALSE;
 	} else {
 		return TRUE;
@@ -100,7 +100,8 @@ plugin_unload(PurplePlugin *plugin, GErr
 	if (ssl_plugin != NULL &&
 		g_list_find(purple_plugins_get_loaded(), ssl_plugin) != NULL)
 	{
-		purple_plugin_unload(ssl_plugin);
+		if (!purple_plugin_unload(ssl_plugin, error))
+			return FALSE;
 	}
 
 	ssl_plugin = NULL;
diff --git a/libpurple/protocols/jabber/libfacebook.c b/libpurple/protocols/jabber/libfacebook.c
--- a/libpurple/protocols/jabber/libfacebook.c
+++ b/libpurple/protocols/jabber/libfacebook.c
@@ -40,6 +40,7 @@
 #include "roster.h"
 #include "si.h"
 #include "message.h"
+#include "plugins.h"
 #include "presence.h"
 #include "google/google.h"
 #include "pep.h"
diff --git a/libpurple/protocols/jabber/libgtalk.c b/libpurple/protocols/jabber/libgtalk.c
--- a/libpurple/protocols/jabber/libgtalk.c
+++ b/libpurple/protocols/jabber/libgtalk.c
@@ -40,6 +40,7 @@
 #include "roster.h"
 #include "si.h"
 #include "message.h"
+#include "plugins.h"
 #include "presence.h"
 #include "google/google.h"
 #include "pep.h"
diff --git a/libpurple/protocols/jabber/libxmpp.c b/libpurple/protocols/jabber/libxmpp.c
--- a/libpurple/protocols/jabber/libxmpp.c
+++ b/libpurple/protocols/jabber/libxmpp.c
@@ -40,6 +40,7 @@
 #include "roster.h"
 #include "si.h"
 #include "message.h"
+#include "plugins.h"
 #include "presence.h"
 #include "google/google.h"
 #include "pep.h"
diff --git a/libpurple/protocols/null/nullprpl.c b/libpurple/protocols/null/nullprpl.c
--- a/libpurple/protocols/null/nullprpl.c
+++ b/libpurple/protocols/null/nullprpl.c
@@ -60,6 +60,7 @@
 #include "connection.h"
 #include "debug.h"
 #include "notify.h"
+#include "plugins.h"
 #include "prpl.h"
 #include "roomlist.h"
 #include "status.h"
diff --git a/libpurple/prpl.h b/libpurple/prpl.h
--- a/libpurple/prpl.h
+++ b/libpurple/prpl.h
@@ -82,7 +82,6 @@ typedef struct _PurpleThumbnailSpec Purp
 #include "media.h"
 #include "notify.h"
 #include "proxy.h"
-#include "plugins.h"
 #include "roomlist.h"
 #include "status.h"
 #include "whiteboard.h"
diff --git a/libpurple/sslconn.c b/libpurple/sslconn.c
--- a/libpurple/sslconn.c
+++ b/libpurple/sslconn.c
@@ -29,6 +29,7 @@
 
 #include "certificate.h"
 #include "debug.h"
+#include "plugins.h"
 #include "request.h"
 #include "sslconn.h"
 
@@ -46,8 +47,8 @@ ssl_init(void)
 
 	plugin = purple_plugins_find_plugin("core-ssl");
 
-	if (plugin != NULL && !purple_plugin_is_loaded(plugin))
-		purple_plugin_load(plugin);
+	if (plugin != NULL)
+		purple_plugin_load(plugin, NULL);
 
 	ops = purple_ssl_get_ops();
 	if ((ops == NULL) || (ops->init == NULL) || (ops->uninit == NULL) ||



More information about the Commits mailing list