/soc/2013/ankitkv/gobjectification: 9fe2d65fe1a7: Use the purple...

Ankit Vani a at nevitus.org
Thu Aug 29 14:08:32 EDT 2013


Changeset: 9fe2d65fe1a7beb500c4f5ea589f064919352c6a
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-08-29 23:38 +0530
Branch:	 soc.2013.gobjectification.plugins
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/9fe2d65fe1a7

Description:

Use the purple_protocol_iface_* API instead of protocol->function()

diffstat:

 finch/gntblist.c                      |  14 ++++++------
 finch/gntconv.c                       |   2 +-
 finch/gntroomlist.c                   |   2 +-
 libpurple/account.c                   |  22 ++++++++++----------
 libpurple/blistnodetypes.c            |   6 ++--
 libpurple/buddyicon.c                 |   2 +-
 libpurple/buddylist.c                 |   4 +-
 libpurple/connection.c                |  12 +++++-----
 libpurple/conversationtypes.c         |   2 +-
 libpurple/log.c                       |   8 +++---
 libpurple/plugins/log_reader.c        |   4 +-
 libpurple/plugins/perl/common/Prpl.xs |   2 +-
 libpurple/presence.c                  |   2 +-
 libpurple/protocols.c                 |   6 ++--
 libpurple/roomlist.c                  |   6 ++--
 libpurple/server.c                    |  38 +++++++++++++++++-----------------
 libpurple/util.c                      |   4 +-
 pidgin/gtkaccount.c                   |   8 +++---
 pidgin/gtkblist.c                     |  28 ++++++++++++------------
 pidgin/gtkconv.c                      |  20 +++++++++---------
 pidgin/gtkroomlist.c                  |   2 +-
 pidgin/gtkutils.c                     |  12 +++++-----
 pidgin/plugins/xmppconsole.c          |   2 +-
 23 files changed, 104 insertions(+), 104 deletions(-)

diffs (truncated from 982 to 300 lines):

diff --git a/finch/gntblist.c b/finch/gntblist.c
--- a/finch/gntblist.c
+++ b/finch/gntblist.c
@@ -744,7 +744,7 @@ add_chat_cb(void *data, PurpleRequestFie
 	gc = purple_account_get_connection(account);
 	protocol = purple_connection_get_protocol_info(gc);
 	if (protocol->chat_info_defaults != NULL)
-		hash = protocol->chat_info_defaults(gc, name);
+		hash = purple_protocol_iface_chat_info_defaults(protocol, gc, name);
 
 	chat = purple_chat_new(account, name, hash);
 
@@ -1067,7 +1067,7 @@ append_proto_menu(GntMenu *menu, PurpleC
 	if(!protocol || !protocol->blist_node_menu)
 		return;
 
-	for(list = protocol->blist_node_menu(node); list;
+	for(list = purple_protocol_iface_blist_node_menu(protocol, node); list;
 			list = g_list_delete_link(list, list))
 	{
 		PurpleMenuAction *act = (PurpleMenuAction *) list->data;
@@ -1290,7 +1290,7 @@ create_buddy_menu(GntMenu *menu, PurpleB
 	if (protocol && protocol->send_file)
 	{
 		if (!protocol->can_receive_file ||
-			protocol->can_receive_file(gc, purple_buddy_get_name(buddy)))
+			purple_protocol_iface_can_receive_file(protocol, gc, purple_buddy_get_name(buddy)))
 			add_custom_action(menu, _("Send File"),
 					PURPLE_CALLBACK(finch_blist_menu_send_file_cb), buddy);
 	}
@@ -1417,7 +1417,7 @@ static void showlog_cb(PurpleBlistNode *
 		account = purple_chat_get_account(c);
 		protocol = purple_find_protocol_info(purple_account_get_protocol_id(account));
 		if (protocol && protocol->get_chat_name) {
-			name = protocol->get_chat_name(purple_chat_get_components(c));
+			name = purple_protocol_iface_get_chat_name(protocol, purple_chat_get_components(c));
 		}
 	} else if (PURPLE_IS_CONTACT(node)) {
 		finch_log_show_contact((PurpleContact *)node);
@@ -1739,7 +1739,7 @@ tooltip_for_buddy(PurpleBuddy *buddy, GS
 
 	protocol = purple_find_protocol_info(purple_account_get_protocol_id(account));
 	if (protocol && protocol->tooltip_text) {
-		protocol->tooltip_text(buddy, user_info, full);
+		purple_protocol_iface_tooltip_text(protocol, buddy, user_info, full);
 	}
 
 	if (purple_prefs_get_bool("/finch/blist/idletime")) {
@@ -2494,7 +2494,7 @@ build_protocol_actions(GntMenuItem *item
 	GntMenuItem *menuitem;
 
 	gnt_menuitem_set_submenu(item, GNT_MENU(sub));
-	for (actions = protocol->get_actions(gc); actions;
+	for (actions = purple_protocol_iface_get_actions(protocol, gc); actions;
 			actions = g_list_delete_link(actions, actions)) {
 		if (actions->data) {
 			PurpleProtocolAction *action = actions->data;
@@ -2818,7 +2818,7 @@ join_chat_select_cb(gpointer data, Purpl
 	if (chat == NULL) {
 		PurpleProtocol *protocol = purple_connection_get_protocol_info(gc);
 		if (protocol->chat_info_defaults != NULL)
-			hash = protocol->chat_info_defaults(gc, name);
+			hash = purple_protocol_iface_chat_info_defaults(protocol, gc, name);
 	} else {
 		hash = purple_chat_get_components(chat);
 	}
diff --git a/finch/gntconv.c b/finch/gntconv.c
--- a/finch/gntconv.c
+++ b/finch/gntconv.c
@@ -705,7 +705,7 @@ create_conv_from_userlist(GntWidget *wid
 
 	protocol = purple_connection_get_protocol_info(gc);
 	if (protocol && PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(protocol, get_cb_real_name))
-		realname = protocol->get_cb_real_name(gc, purple_chat_conversation_get_id(
+		realname = purple_protocol_iface_get_cb_real_name(protocol, gc, purple_chat_conversation_get_id(
 				PURPLE_CHAT_CONVERSATION(fc->active_conv)), name);
 	else
 		realname = NULL;
diff --git a/finch/gntroomlist.c b/finch/gntroomlist.c
--- a/finch/gntroomlist.c
+++ b/finch/gntroomlist.c
@@ -121,7 +121,7 @@ static void fl_add_chat(GntWidget *butto
 	protocol = purple_connection_get_protocol_info(gc);
 
 	if(protocol != NULL && protocol->roomlist_room_serialize)
-		name = protocol->roomlist_room_serialize(room);
+		name = purple_protocol_iface_roomlist_room_serialize(protocol, room);
 	else
 		name = g_strdup(purple_roomlist_room_get_name(room));
 
diff --git a/libpurple/account.c b/libpurple/account.c
--- a/libpurple/account.c
+++ b/libpurple/account.c
@@ -1024,7 +1024,7 @@ purple_account_set_public_alias(PurpleAc
 	protocol = purple_connection_get_protocol_info(gc);
 
 	if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(protocol, set_public_alias))
-		protocol->set_public_alias(gc, alias, success_cb, failure_cb);
+		purple_protocol_iface_set_public_alias(protocol, gc, alias, success_cb, failure_cb);
 	else if (failure_cb) {
 		struct public_alias_closure *closure =
 				g_new0(struct public_alias_closure, 1);
@@ -1062,7 +1062,7 @@ purple_account_get_public_alias(PurpleAc
 	protocol = purple_connection_get_protocol_info(gc);
 
 	if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(protocol, get_public_alias))
-		protocol->get_public_alias(gc, success_cb, failure_cb);
+		purple_protocol_iface_get_public_alias(protocol, gc, success_cb, failure_cb);
 	else if (failure_cb) {
 		struct public_alias_closure *closure =
 				g_new0(struct public_alias_closure, 1);
@@ -2221,7 +2221,7 @@ purple_account_add_buddy(PurpleAccount *
 
 	if (protocol != NULL) {
 		if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(protocol, add_buddy))
-			protocol->add_buddy(gc, buddy, purple_buddy_get_group(buddy), message);
+			purple_protocol_iface_add_buddy(protocol, gc, buddy, purple_buddy_get_group(buddy), message);
 	}
 }
 
@@ -2244,12 +2244,12 @@ purple_account_add_buddies(PurpleAccount
 		}
 
 		if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(protocol, add_buddies))
-			protocol->add_buddies(gc, buddies, groups, message);
+			purple_protocol_iface_add_buddies(protocol, gc, buddies, groups, message);
 		else if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(protocol, add_buddy)) {
 			GList *curb = buddies, *curg = groups;
 
 			while ((curb != NULL) && (curg != NULL)) {
-				protocol->add_buddy(gc, curb->data, curg->data, message);
+				purple_protocol_iface_add_buddy(protocol, gc, curb->data, curg->data, message);
 				curb = curb->next;
 				curg = curg->next;
 			}
@@ -2270,7 +2270,7 @@ purple_account_remove_buddy(PurpleAccoun
 		protocol = purple_connection_get_protocol_info(gc);
 
 	if (protocol && protocol->remove_buddy)
-		protocol->remove_buddy(gc, buddy, group);
+		purple_protocol_iface_remove_buddy(protocol, gc, buddy, group);
 }
 
 void
@@ -2284,7 +2284,7 @@ purple_account_remove_buddies(PurpleAcco
 
 	if (protocol) {
 		if (protocol->remove_buddies)
-			protocol->remove_buddies(gc, buddies, groups);
+			purple_protocol_iface_remove_buddies(protocol, gc, buddies, groups);
 		else {
 			GList *curb = buddies;
 			GList *curg = groups;
@@ -2307,7 +2307,7 @@ purple_account_remove_group(PurpleAccoun
 		protocol = purple_connection_get_protocol_info(gc);
 
 	if (protocol && protocol->remove_group)
-		protocol->remove_group(gc, group);
+		purple_protocol_iface_remove_group(protocol, gc, group);
 }
 
 void
@@ -2323,7 +2323,7 @@ purple_account_change_password(PurpleAcc
 		protocol = purple_connection_get_protocol_info(gc);
 
 	if (protocol && protocol->change_passwd)
-		protocol->change_passwd(gc, orig_pw, new_pw);
+		purple_protocol_iface_change_passwd(protocol, gc, orig_pw, new_pw);
 }
 
 gboolean purple_account_supports_offline_message(PurpleAccount *account, PurpleBuddy *buddy)
@@ -2342,7 +2342,7 @@ gboolean purple_account_supports_offline
 
 	if (!protocol || !protocol->offline_message)
 		return FALSE;
-	return protocol->offline_message(buddy);
+	return purple_protocol_iface_offline_message(protocol, buddy);
 }
 
 void
@@ -2891,7 +2891,7 @@ purple_account_constructed(GObject *obje
 
 	if (protocol->status_types != NULL)
 		purple_account_set_status_types(account,
-				protocol->status_types(account));
+				purple_protocol_iface_status_types(protocol, account));
 
 	priv->presence = PURPLE_PRESENCE(purple_account_presence_new(account));
 
diff --git a/libpurple/blistnodetypes.c b/libpurple/blistnodetypes.c
--- a/libpurple/blistnodetypes.c
+++ b/libpurple/blistnodetypes.c
@@ -636,7 +636,7 @@ purple_buddy_dispose(GObject *object)
 	 */
 	protocol = purple_find_protocol_info(purple_account_get_protocol_id(priv->account));
 	if (protocol && protocol->buddy_free)
-		protocol->buddy_free(buddy);
+		purple_protocol_iface_buddy_free(protocol, buddy);
 
 	/* Delete the node */
 	purple_buddy_icon_unref(priv->icon);
@@ -1124,7 +1124,7 @@ const char *purple_chat_get_name_only(Pu
 
 	if (protocol->chat_info) {
 		PurpleProtocolChatEntry *pce;
-		GList *parts = protocol->chat_info(purple_account_get_connection(priv->account));
+		GList *parts = purple_protocol_iface_chat_info(protocol, purple_account_get_connection(priv->account));
 		pce = parts->data;
 		ret = g_hash_table_lookup(priv->components, pce->identifier);
 		g_list_foreach(parts, (GFunc)g_free, NULL);
@@ -1535,7 +1535,7 @@ void purple_group_set_name(PurpleGroup *
 			}
 
 			if(protocol->rename_group) {
-				protocol->rename_group(gc, old_name, source, buddies);
+				purple_protocol_iface_rename_group(protocol, gc, old_name, source, buddies);
 			} else {
 				GList *cur, *groups = NULL;
 
diff --git a/libpurple/buddyicon.c b/libpurple/buddyicon.c
--- a/libpurple/buddyicon.c
+++ b/libpurple/buddyicon.c
@@ -751,7 +751,7 @@ purple_buddy_icons_set_account_icon(Purp
 		protocol = purple_connection_get_protocol_info(gc);
 
 		if (protocol && protocol->set_buddy_icon)
-			protocol->set_buddy_icon(gc, img);
+			purple_protocol_iface_set_buddy_icon(protocol, gc, img);
 	}
 
 	if (old_img)
diff --git a/libpurple/buddylist.c b/libpurple/buddylist.c
--- a/libpurple/buddylist.c
+++ b/libpurple/buddylist.c
@@ -1637,7 +1637,7 @@ purple_blist_find_chat(PurpleAccount *ac
 	protocol = purple_find_protocol_info(purple_account_get_protocol_id(account));
 
 	if (protocol->find_blist_chat != NULL)
-		return protocol->find_blist_chat(account, name);
+		return purple_protocol_iface_find_blist_chat(protocol, account, name);
 
 	normname = g_strdup(purple_normalize(account, name));
 	for (group = purplebuddylist->root; group != NULL; group = group->next) {
@@ -1649,7 +1649,7 @@ purple_blist_find_chat(PurpleAccount *ac
 				if (account != purple_chat_get_account(chat))
 					continue;
 
-				parts = protocol->chat_info(
+				parts = purple_protocol_iface_chat_info(protocol, 
 					purple_account_get_connection(purple_chat_get_account(chat)));
 
 				pce = parts->data;
diff --git a/libpurple/connection.c b/libpurple/connection.c
--- a/libpurple/connection.c
+++ b/libpurple/connection.c
@@ -121,7 +121,7 @@ send_keepalive(gpointer data)
 		return TRUE;
 
 	if (priv->protocol->keepalive)
-		priv->protocol->keepalive(gc);
+		priv->purple_protocol_iface_keepalive(protocol, gc);
 
 	return TRUE;
 }
@@ -753,7 +753,7 @@ purple_connection_dispose(GObject *objec
 	purple_proxy_connect_cancel_with_handle(gc);
 
 	if (priv->protocol->close)
-		priv->protocol->close(gc);
+		priv->purple_protocol_iface_close(protocol, gc);
 
 	/* Clear out the proto data that was freed in the prpl close method*/
 	buddies = purple_blist_find_buddies(account, NULL);
@@ -937,14 +937,14 @@ void
 		/* set this so we don't auto-reconnect after registering */
 		PURPLE_CONNECTION_GET_PRIVATE(gc)->wants_to_die = TRUE;
 
-		protocol->register_user(account);
+		purple_protocol_iface_register_user(protocol, account);
 	}
 	else
 	{
 		purple_debug_info("connection", "Connecting. gc = %p\n", gc);
 
 		purple_signal_emit(purple_accounts_get_handle(), "account-connecting", account);
-		protocol->login(account);
+		purple_protocol_iface_login(protocol, account);
 	}
 }
 
@@ -971,7 +971,7 @@ void
 	}
 
 	if (!purple_account_is_disconnected(account)) {
-		protocol->unregister_user(account, cb, user_data);
+		purple_protocol_iface_unregister_user(protocol, account, cb, user_data);
 		return;
 	}
 
@@ -992,7 +992,7 @@ void



More information about the Commits mailing list