/soc/2013/ankitkv/gobjectification: e518ad02107d: Replaced purpl...

Ankit Vani a at nevitus.org
Sun Jul 28 14:24:43 EDT 2013


Changeset: e518ad02107df2cfa1f96ec1385e8ae16d9311a9
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-07-28 23:44 +0530
Branch:	 soc.2013.gobjectification.plugins
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/e518ad02107d

Description:

Replaced purple_connection_get_prpl() with purple_connection_get_protocol_info().
Changed its return type from PurplePlugin * to PurplePluginProtocolInfo *

diffstat:

 finch/gntblist.c                      |  12 +++++-----
 finch/gntconv.c                       |   6 ++--
 finch/gntroomlist.c                   |   4 +-
 libpurple/account.c                   |  28 +++++++++++---------------
 libpurple/blistnodetypes.c            |   2 +-
 libpurple/buddyicon.c                 |   2 +-
 libpurple/connection.c                |   6 ++--
 libpurple/connection.h                |   2 +-
 libpurple/conversationtypes.c         |   8 +++---
 libpurple/plugins/perl/common/Prpl.xs |   2 +-
 libpurple/plugins/signals-test.c      |   2 +-
 libpurple/presence.c                  |   2 +-
 libpurple/protocols/irc/msgs.c        |   2 +-
 libpurple/protocols/jabber/iq.c       |   4 +-
 libpurple/protocols/jabber/jabber.c   |   6 ++--
 libpurple/protocols/jabber/message.c  |   2 +-
 libpurple/protocols/jabber/presence.c |   2 +-
 libpurple/prpl.c                      |   4 +-
 libpurple/roomlist.c                  |   6 ++--
 libpurple/server.c                    |  36 +++++++++++++++++-----------------
 libpurple/whiteboard.c                |   2 +-
 pidgin/gtkblist.c                     |  30 ++++++++++++++--------------
 pidgin/gtkconv.c                      |  30 ++++++++++++++--------------
 pidgin/gtkdocklet.c                   |   6 ++--
 pidgin/gtkimhtmltoolbar.c             |   2 +-
 pidgin/gtkroomlist.c                  |   4 +-
 pidgin/gtkutils.c                     |   8 +++---
 pidgin/gtkwebviewtoolbar.c            |   2 +-
 pidgin/plugins/disco/xmppdisco.c      |   8 +++---
 pidgin/plugins/xmppconsole.c          |   2 +-
 30 files changed, 114 insertions(+), 118 deletions(-)

diffs (truncated from 1106 to 300 lines):

diff --git a/finch/gntblist.c b/finch/gntblist.c
--- a/finch/gntblist.c
+++ b/finch/gntblist.c
@@ -741,7 +741,7 @@ add_chat_cb(void *data, PurpleRequestFie
 		group = _("Chats");
 
 	gc = purple_account_get_connection(account);
-	info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc));
+	info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_protocol_info(gc));
 	if (info->chat_info_defaults != NULL)
 		hash = info->chat_info_defaults(gc, name);
 
@@ -1061,7 +1061,7 @@ static void
 append_proto_menu(GntMenu *menu, PurpleConnection *gc, PurpleBlistNode *node)
 {
 	GList *list;
-	PurplePluginProtocolInfo *prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc));
+	PurplePluginProtocolInfo *prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_protocol_info(gc));
 
 	if(!prpl_info || !prpl_info->blist_node_menu)
 		return;
@@ -1125,7 +1125,7 @@ chat_components_edit(PurpleBlistNode *se
 	purple_request_fields_add_group(fields, group);
 
 	gc = purple_account_get_connection(purple_chat_get_account(chat));
-	parts = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc))->chat_info(gc);
+	parts = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_protocol_info(gc))->chat_info(gc);
 
 	for (iter = parts; iter; iter = iter->next) {
 		pce = iter->data;
@@ -1276,7 +1276,7 @@ create_buddy_menu(GntMenu *menu, PurpleB
 	PurplePluginProtocolInfo *prpl_info;
 	PurpleConnection *gc = purple_account_get_connection(purple_buddy_get_account(buddy));
 
-	prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc));
+	prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_protocol_info(gc));
 	if (prpl_info && prpl_info->get_info)
 	{
 		add_custom_action(menu, _("Get Info"),
@@ -2578,7 +2578,7 @@ reconstruct_accounts_menu(void)
 
 		if (!gc || !PURPLE_CONNECTION_IS_CONNECTED(gc))
 			continue;
-		prpl = purple_connection_get_prpl(gc);
+		prpl = purple_connection_get_protocol_info(gc);
 
 		if (PURPLE_PLUGIN_HAS_ACTIONS(prpl)) {
 			item = gnt_menuitem_new(purple_account_get_username(account));
@@ -2783,7 +2783,7 @@ join_chat_select_cb(gpointer data, Purpl
 
 	chat = purple_blist_find_chat(account, name);
 	if (chat == NULL) {
-		PurplePluginProtocolInfo *info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc));
+		PurplePluginProtocolInfo *info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_protocol_info(gc));
 		if (info->chat_info_defaults != NULL)
 			hash = info->chat_info_defaults(gc, name);
 	} else {
diff --git a/finch/gntconv.c b/finch/gntconv.c
--- a/finch/gntconv.c
+++ b/finch/gntconv.c
@@ -339,7 +339,7 @@ account_signed_on_off(PurpleConnection *
 
 			chat = find_chat_for_conversation(conv);
 			if (chat == NULL) {
-				PurplePluginProtocolInfo *info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc));
+				PurplePluginProtocolInfo *info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_protocol_info(gc));
 				if (info->chat_info_defaults != NULL)
 					comps = info->chat_info_defaults(gc, purple_conversation_get_name(conv));
 			} else {
@@ -637,7 +637,7 @@ gg_create_menu(FinchConv *ggc)
 		PurpleAccount *account = purple_conversation_get_account(ggc->active_conv);
 		PurpleConnection *gc = purple_account_get_connection(account);
 		PurplePluginProtocolInfo *pinfo =
-			gc ? PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)) : NULL;
+			gc ? PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_protocol_info(gc)) : NULL;
 
 		if (pinfo && pinfo->get_info) {
 			item = gnt_menuitem_new(_("Get Info"));
@@ -703,7 +703,7 @@ create_conv_from_userlist(GntWidget *wid
 
 	name = gnt_tree_get_selection_data(GNT_TREE(widget));
 
-	prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc));
+	prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_protocol_info(gc));
 	if (prpl_info && PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, get_cb_real_name))
 		realname = prpl_info->get_cb_real_name(gc, purple_chat_conversation_get_id(
 				PURPLE_CHAT_CONVERSATION(fc->active_conv)), name);
diff --git a/finch/gntroomlist.c b/finch/gntroomlist.c
--- a/finch/gntroomlist.c
+++ b/finch/gntroomlist.c
@@ -118,7 +118,7 @@ static void fl_add_chat(GntWidget *butto
 	if (gc == NULL || room == NULL)
 		return;
 
-	prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc));
+	prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_protocol_info(gc));
 
 	if(prpl_info != NULL && prpl_info->roomlist_room_serialize)
 		name = prpl_info->roomlist_room_serialize(room);
@@ -240,7 +240,7 @@ reset_account_list(PurpleAccount *accoun
 		PurplePluginProtocolInfo *prpl_info = NULL;
 		PurpleConnection *gc = list->data;
 
-		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc));
+		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_protocol_info(gc));
 		if (PURPLE_CONNECTION_IS_CONNECTED(gc) &&
 		        prpl_info->roomlist_get_list != NULL) {
 			PurpleAccount *account = purple_connection_get_account(gc);
diff --git a/libpurple/account.c b/libpurple/account.c
--- a/libpurple/account.c
+++ b/libpurple/account.c
@@ -308,7 +308,6 @@ purple_account_connect_got_password_cb(P
 void
 purple_account_connect(PurpleAccount *account)
 {
-	PurplePlugin *prpl;
 	const char *username;
 	PurplePluginProtocolInfo *prpl_info;
 	PurpleAccountPrivate *priv;
@@ -324,8 +323,8 @@ purple_account_connect(PurpleAccount *ac
 		return;
 	}
 
-	prpl = purple_find_protocol_info(purple_account_get_protocol_id(account));
-	if (prpl == NULL) {
+	prpl_info = purple_find_protocol_info(purple_account_get_protocol_id(account));
+	if (prpl_info == NULL) {
 		gchar *message;
 
 		message = g_strdup_printf(_("Missing protocol plugin for %s"), username);
@@ -338,7 +337,6 @@ purple_account_connect(PurpleAccount *ac
 
 	purple_debug_info("account", "Connecting to account %s.\n", username);
 
-	prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
 	if (priv->password != NULL) {
 		purple_account_connect_got_password_cb(account,
 			priv->password, NULL, prpl_info);
@@ -625,9 +623,7 @@ purple_account_request_change_password(P
 
 	gc = purple_account_get_connection(account);
 	if (gc != NULL)
-		prpl = purple_connection_get_prpl(gc);
-	if (prpl != NULL)
-		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
+		prpl_info = purple_connection_get_protocol_info(gc);
 
 	fields = purple_request_fields_new();
 
@@ -1027,7 +1023,7 @@ purple_account_set_public_alias(PurpleAc
 	g_return_if_fail(purple_account_is_connected(account));
 
 	gc = purple_account_get_connection(account);
-	prpl = purple_connection_get_prpl(gc);
+	prpl = purple_connection_get_protocol_info(gc);
 	prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
 
 	if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, set_public_alias))
@@ -1067,7 +1063,7 @@ purple_account_get_public_alias(PurpleAc
 	g_return_if_fail(purple_account_is_connected(account));
 
 	gc = purple_account_get_connection(account);
-	prpl = purple_connection_get_prpl(gc);
+	prpl = purple_connection_get_protocol_info(gc);
 	prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
 
 	if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, get_public_alias))
@@ -2227,7 +2223,7 @@ purple_account_add_buddy(PurpleAccount *
 
 	gc = purple_account_get_connection(account);
 	if (gc != NULL)
-		prpl = purple_connection_get_prpl(gc);
+		prpl = purple_connection_get_protocol_info(gc);
 
 	if (prpl != NULL)
 		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
@@ -2246,7 +2242,7 @@ purple_account_add_buddies(PurpleAccount
 	PurplePlugin *prpl = NULL;
 
 	if (gc != NULL)
-		prpl = purple_connection_get_prpl(gc);
+		prpl = purple_connection_get_protocol_info(gc);
 
 	if (prpl != NULL)
 		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
@@ -2285,7 +2281,7 @@ purple_account_remove_buddy(PurpleAccoun
 	PurplePlugin *prpl = NULL;
 
 	if (gc != NULL)
-		prpl = purple_connection_get_prpl(gc);
+		prpl = purple_connection_get_protocol_info(gc);
 
 	if (prpl != NULL)
 		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
@@ -2302,7 +2298,7 @@ purple_account_remove_buddies(PurpleAcco
 	PurplePlugin *prpl = NULL;
 
 	if (gc != NULL)
-		prpl = purple_connection_get_prpl(gc);
+		prpl = purple_connection_get_protocol_info(gc);
 
 	if (prpl != NULL)
 		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
@@ -2330,7 +2326,7 @@ purple_account_remove_group(PurpleAccoun
 	PurplePlugin *prpl = NULL;
 
 	if (gc != NULL)
-		prpl = purple_connection_get_prpl(gc);
+		prpl = purple_connection_get_protocol_info(gc);
 
 	if (prpl != NULL)
 		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
@@ -2350,7 +2346,7 @@ purple_account_change_password(PurpleAcc
 	purple_account_set_password(account, new_pw, NULL, NULL);
 
 	if (gc != NULL)
-		prpl = purple_connection_get_prpl(gc);
+		prpl = purple_connection_get_protocol_info(gc);
 
 	if (prpl != NULL)
 		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
@@ -2372,7 +2368,7 @@ gboolean purple_account_supports_offline
 	if (gc == NULL)
 		return FALSE;
 
-	prpl = purple_connection_get_prpl(gc);
+	prpl = purple_connection_get_protocol_info(gc);
 
 	if (prpl != NULL)
 		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
diff --git a/libpurple/blistnodetypes.c b/libpurple/blistnodetypes.c
--- a/libpurple/blistnodetypes.c
+++ b/libpurple/blistnodetypes.c
@@ -1529,7 +1529,7 @@ void purple_group_set_name(PurpleGroup *
 			gc = purple_account_get_connection(account);
 
 			if(gc)
-				prpl = purple_connection_get_prpl(gc);
+				prpl = purple_connection_get_protocol_info(gc);
 
 			if(gc && prpl)
 				prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
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_prpl(gc));
+		prpl_info = PURPLE_PLUGIN_PROTOCOL_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/connection.c b/libpurple/connection.c
--- a/libpurple/connection.c
+++ b/libpurple/connection.c
@@ -320,8 +320,8 @@ purple_connection_get_account(const Purp
 	return priv->account;
 }
 
-PurplePlugin *
-purple_connection_get_prpl(const PurpleConnection *gc)
+PurplePluginProtocolInfo *
+purple_connection_get_protocol_info(const PurpleConnection *gc)
 {
 	PurpleConnectionPrivate *priv = PURPLE_CONNECTION_GET_PRIVATE(gc);
 
@@ -646,7 +646,7 @@ purple_connection_get_property(GObject *
 	switch (param_id) {
 		case PROP_PRPL:
 #warning TODO: change set_pointer to set_object when prpl is a GObject
-			g_value_set_pointer(value, purple_connection_get_prpl(gc));
+			g_value_set_pointer(value, purple_connection_get_protocol_info(gc));
 			break;
 		case PROP_FLAGS:
 			g_value_set_flags(value, purple_connection_get_flags(gc));
diff --git a/libpurple/connection.h b/libpurple/connection.h
--- a/libpurple/connection.h
+++ b/libpurple/connection.h
@@ -357,7 +357,7 @@ PurpleAccount *purple_connection_get_acc
  *
  * @return The protocol plugin.
  */
-PurplePlugin * purple_connection_get_prpl(const PurpleConnection *gc);
+PurplePluginProtocolInfo *purple_connection_get_protocol_info(const PurpleConnection *gc);
 
 /**
  * Returns the connection's password.
diff --git a/libpurple/conversationtypes.c b/libpurple/conversationtypes.c
--- a/libpurple/conversationtypes.c
+++ b/libpurple/conversationtypes.c
@@ -460,7 +460,7 @@ purple_im_conversation_dispose(GObject *
 	if (gc != NULL)
 	{
 		/* Still connected */
-		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc));
+		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_protocol_info(gc));
 
 		if (purple_prefs_get_bool("/purple/conversations/im/send_typing"))



More information about the Commits mailing list