/soc/2013/ankitkv/gobjectification: 41150570364f: Refactored fin...

Ankit Vani a at nevitus.org
Sat Sep 14 12:47:16 EDT 2013


Changeset: 41150570364f29f775060d404e213cacc58a570e
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-09-14 22:16 +0530
Branch:	 soc.2013.gobjectification.plugins
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/41150570364f

Description:

Refactored finch to use the new protocol API

diffstat:

 finch/gntaccount.c  |   4 ++--
 finch/gntblist.c    |  10 +++++-----
 finch/gntconv.c     |   6 +++---
 finch/gntroomlist.c |   4 ++--
 4 files changed, 12 insertions(+), 12 deletions(-)

diffs (107 lines):

diff --git a/finch/gntaccount.c b/finch/gntaccount.c
--- a/finch/gntaccount.c
+++ b/finch/gntaccount.c
@@ -251,7 +251,7 @@ save_account_cb(AccountEditDialog *dialo
 		gnt_box_give_focus_to_child(GNT_BOX(accounts.window), accounts.tree);
 	}
 
-	if (protocol && PURPLE_PROTOCOL_IMPLEMENTS(protocol, register_user) &&
+	if (protocol && PURPLE_PROTOCOL_IMPLEMENTS(protocol, SERVER_IFACE, register_user) &&
 			gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->regserver))) {
 		purple_account_register(account);
 	} else if (dialog->account == NULL) {
@@ -484,7 +484,7 @@ add_protocol_options(AccountEditDialog *
 	/* Show the registration checkbox only in a new account dialog,
 	 * and when the selected protocol has the support for it. */
 	gnt_widget_set_visible(dialog->regserver, account == NULL &&
-			PURPLE_PROTOCOL_IMPLEMENTS(protocol, register_user));
+			PURPLE_PROTOCOL_IMPLEMENTS(protocol, SERVER_IFACE, register_user));
 }
 
 static void
diff --git a/finch/gntblist.c b/finch/gntblist.c
--- a/finch/gntblist.c
+++ b/finch/gntblist.c
@@ -1061,7 +1061,7 @@ append_proto_menu(GntMenu *menu, PurpleC
 	GList *list;
 	PurpleProtocol *protocol = purple_connection_get_protocol(gc);
 
-	if(!protocol || !PURPLE_PROTOCOL_IMPLEMENTS(protocol, blist_node_menu))
+	if(!protocol || !PURPLE_PROTOCOL_IMPLEMENTS(protocol, CLIENT_IFACE, blist_node_menu))
 		return;
 
 	for(list = purple_protocol_client_iface_blist_node_menu(protocol, node); list;
@@ -1274,7 +1274,7 @@ create_buddy_menu(GntMenu *menu, PurpleB
 	PurpleConnection *gc = purple_account_get_connection(purple_buddy_get_account(buddy));
 
 	protocol = purple_connection_get_protocol(gc);
-	if (protocol && PURPLE_PROTOCOL_IMPLEMENTS(protocol, get_info))
+	if (protocol && PURPLE_PROTOCOL_IMPLEMENTS(protocol, SERVER_IFACE, get_info))
 	{
 		add_custom_action(menu, _("Get Info"),
 				PURPLE_CALLBACK(finch_blist_get_buddy_info_cb), buddy);
@@ -1283,9 +1283,9 @@ create_buddy_menu(GntMenu *menu, PurpleB
 	add_custom_action(menu, _("Add Buddy Pounce"),
 			PURPLE_CALLBACK(finch_blist_pounce_node_cb), buddy);
 
-	if (protocol && PURPLE_PROTOCOL_IMPLEMENTS(protocol, send_file))
+	if (protocol && PURPLE_PROTOCOL_IMPLEMENTS(protocol, XFER_IFACE, send))
 	{
-		if (!PURPLE_PROTOCOL_IMPLEMENTS(protocol, can_receive_file) ||
+		if (!PURPLE_PROTOCOL_IMPLEMENTS(protocol, XFER_IFACE, can_receive) ||
 			purple_protocol_xfer_iface_can_receive(protocol, gc, purple_buddy_get_name(buddy)))
 			add_custom_action(menu, _("Send File"),
 					PURPLE_CALLBACK(finch_blist_menu_send_file_cb), buddy);
@@ -2608,7 +2608,7 @@ reconstruct_accounts_menu(void)
 			continue;
 		protocol = purple_connection_get_protocol(gc);
 
-		if (PURPLE_PROTOCOL_IMPLEMENTS(protocol, get_actions)) {
+		if (PURPLE_PROTOCOL_IMPLEMENTS(protocol, CLIENT_IFACE, get_actions)) {
 			item = gnt_menuitem_new(purple_account_get_username(account));
 			gnt_menu_add_item(GNT_MENU(sub), item);
 			build_protocol_actions(item, protocol, gc);
diff --git a/finch/gntconv.c b/finch/gntconv.c
--- a/finch/gntconv.c
+++ b/finch/gntconv.c
@@ -639,7 +639,7 @@ gg_create_menu(FinchConv *ggc)
 		PurpleProtocol *protocol =
 			gc ? purple_connection_get_protocol(gc) : NULL;
 
-		if (protocol && PURPLE_PROTOCOL_IMPLEMENTS(protocol, get_info)) {
+		if (protocol && PURPLE_PROTOCOL_IMPLEMENTS(protocol, SERVER_IFACE, get_info)) {
 			item = gnt_menuitem_new(_("Get Info"));
 			gnt_menu_add_item(GNT_MENU(sub), item);
 			gnt_menuitem_set_callback(item, get_info_cb, ggc);
@@ -649,8 +649,8 @@ gg_create_menu(FinchConv *ggc)
 		gnt_menu_add_item(GNT_MENU(sub), item);
 		gnt_menuitem_set_callback(item, add_pounce_cb, ggc);
 
-		if (protocol && PURPLE_PROTOCOL_IMPLEMENTS(protocol, send_file) &&
-				(!PURPLE_PROTOCOL_IMPLEMENTS(protocol, can_receive_file) ||
+		if (protocol && PURPLE_PROTOCOL_IMPLEMENTS(protocol, XFER_IFACE, send) &&
+				(!PURPLE_PROTOCOL_IMPLEMENTS(protocol, XFER_IFACE, can_receive) ||
 					purple_protocol_xfer_iface_can_receive(protocol, gc,
 					purple_conversation_get_name(ggc->active_conv)))) {
 			item = gnt_menuitem_new(_("Send File"));
diff --git a/finch/gntroomlist.c b/finch/gntroomlist.c
--- a/finch/gntroomlist.c
+++ b/finch/gntroomlist.c
@@ -120,7 +120,7 @@ static void fl_add_chat(GntWidget *butto
 
 	protocol = purple_connection_get_protocol(gc);
 
-	if(protocol != NULL && PURPLE_PROTOCOL_IMPLEMENTS(protocol, roomlist_room_serialize))
+	if(protocol != NULL && PURPLE_PROTOCOL_IMPLEMENTS(protocol, ROOMLIST_IFACE, room_serialize))
 		name = purple_protocol_roomlist_iface_room_serialize(protocol, room);
 	else
 		name = g_strdup(purple_roomlist_room_get_name(room));
@@ -242,7 +242,7 @@ reset_account_list(PurpleAccount *accoun
 
 		protocol = purple_connection_get_protocol(gc);
 		if (PURPLE_CONNECTION_IS_CONNECTED(gc) &&
-		        PURPLE_PROTOCOL_IMPLEMENTS(protocol, roomlist_get_list)) {
+		        PURPLE_PROTOCOL_IMPLEMENTS(protocol, ROOMLIST_IFACE, get_list)) {
 			PurpleAccount *account = purple_connection_get_account(gc);
 			char *text = g_strdup_printf("%s (%s)",
 					purple_account_get_username(account),



More information about the Commits mailing list