/soc/2013/ankitkv/gobjectification: 3e80571fb825: Refactored bli...

Ankit Vani a at nevitus.org
Sun Jul 28 14:42:15 EDT 2013


Changeset: 3e80571fb825f8ef5aafab7097990d8afa825a6f
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-07-29 00:12 +0530
Branch:	 soc.2013.gobjectification.plugins
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/3e80571fb825

Description:

Refactored blistnodetypes, buddyicon, buddylist to use the initial GObject plugin API

diffstat:

 libpurple/blistnodetypes.c |  20 +++++---------------
 libpurple/buddyicon.c      |   2 +-
 libpurple/buddylist.c      |   4 +---
 libpurple/connection.h     |   2 +-
 4 files changed, 8 insertions(+), 20 deletions(-)

diffs (106 lines):

diff --git a/libpurple/blistnodetypes.c b/libpurple/blistnodetypes.c
--- a/libpurple/blistnodetypes.c
+++ b/libpurple/blistnodetypes.c
@@ -628,19 +628,15 @@ purple_buddy_dispose(GObject *object)
 {
 	PurpleBuddy *buddy = PURPLE_BUDDY(object);
 	PurpleBuddyPrivate *priv = PURPLE_BUDDY_GET_PRIVATE(buddy);
-	PurplePlugin *prpl;
 	PurplePluginProtocolInfo *prpl_info;
 
 	/*
 	 * Tell the owner PRPL that we're about to free the buddy so it
 	 * can free proto_data
 	 */
-	prpl = purple_find_protocol_info(purple_account_get_protocol_id(priv->account));
-	if (prpl) {
-		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
-		if (prpl_info && prpl_info->buddy_free)
-			prpl_info->buddy_free(buddy);
-	}
+	prpl_info = purple_find_protocol_info(purple_account_get_protocol_id(priv->account));
+	if (prpl_info && prpl_info->buddy_free)
+		prpl_info->buddy_free(buddy);
 
 	/* Delete the node */
 	purple_buddy_icon_unref(priv->icon);
@@ -1119,14 +1115,12 @@ const char *purple_chat_get_name(PurpleC
 const char *purple_chat_get_name_only(PurpleChat *chat)
 {
 	char *ret = NULL;
-	PurplePlugin *prpl;
 	PurplePluginProtocolInfo *prpl_info = NULL;
 	PurpleChatPrivate *priv = PURPLE_CHAT_GET_PRIVATE(chat);
 
 	g_return_val_if_fail(priv != NULL, NULL);
 
-	prpl = purple_find_protocol_info(purple_account_get_protocol_id(priv->account));
-	prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
+	prpl_info = purple_find_protocol_info(purple_account_get_protocol_id(priv->account));
 
 	if (prpl_info->chat_info) {
 		struct proto_chat_entry *pce;
@@ -1522,17 +1516,13 @@ void purple_group_set_name(PurpleGroup *
 		for (accts = purple_group_get_accounts(source); accts; accts = g_slist_remove(accts, accts->data)) {
 			PurpleAccount *account = accts->data;
 			PurpleConnection *gc = NULL;
-			PurplePlugin *prpl = NULL;
 			PurplePluginProtocolInfo *prpl_info = NULL;
 			GList *l = NULL, *buddies = NULL;
 
 			gc = purple_account_get_connection(account);
 
 			if(gc)
-				prpl = purple_connection_get_protocol_info(gc);
-
-			if(gc && prpl)
-				prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
+				prpl_info = purple_connection_get_protocol_info(gc);
 
 			if(!prpl_info)
 				continue;
diff --git a/libpurple/buddyicon.c b/libpurple/buddyicon.c
--- a/libpurple/buddyicon.c
+++ b/libpurple/buddyicon.c
@@ -748,7 +748,7 @@ purple_buddy_icons_set_account_icon(Purp
 		PurplePluginProtocolInfo *prpl_info;
 
 		gc = purple_account_get_connection(account);
-		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_protocol_info(gc));
+		prpl_info = purple_connection_get_protocol_info(gc);
 
 		if (prpl_info && prpl_info->set_buddy_icon)
 			prpl_info->set_buddy_icon(gc, img);
diff --git a/libpurple/buddylist.c b/libpurple/buddylist.c
--- a/libpurple/buddylist.c
+++ b/libpurple/buddylist.c
@@ -1622,7 +1622,6 @@ purple_blist_find_chat(PurpleAccount *ac
 {
 	char *chat_name;
 	PurpleChat *chat;
-	PurplePlugin *prpl;
 	PurplePluginProtocolInfo *prpl_info = NULL;
 	struct proto_chat_entry *pce;
 	PurpleBlistNode *node, *group;
@@ -1635,8 +1634,7 @@ purple_blist_find_chat(PurpleAccount *ac
 	if (!purple_account_is_connected(account))
 		return NULL;
 
-	prpl = purple_find_protocol_info(purple_account_get_protocol_id(account));
-	prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
+	prpl_info = purple_find_protocol_info(purple_account_get_protocol_id(account));
 
 	if (prpl_info->find_blist_chat != NULL)
 		return prpl_info->find_blist_chat(account, name);
diff --git a/libpurple/connection.h b/libpurple/connection.h
--- a/libpurple/connection.h
+++ b/libpurple/connection.h
@@ -155,7 +155,7 @@ typedef struct
 #include <time.h>
 
 #include "account.h"
-#include "plugin.h"
+#include "prpl.h"
 #include "status.h"
 #include "sslconn.h"
 



More information about the Commits mailing list