/soc/2013/ankitkv/gobjectification: 4808d6391e69: Merged soc.201...

Ankit Vani a at nevitus.org
Sun Nov 17 13:33:53 EST 2013


Changeset: 4808d6391e69191aca70b10516391cc7f7d6ee78
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-11-18 00:03 +0530
Branch:	 soc.2013.gobjectification.plugins
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/4808d6391e69

Description:

Merged soc.2013.gobjectification branch

diffstat:

 finch/gntconv.c                         |  16 ++++++--
 libpurple/protocols/jabber/message.c    |   4 +-
 libpurple/protocols/msn/switchboard.c   |   2 +-
 libpurple/protocols/mxit/mxit.c         |   2 +-
 libpurple/protocols/sametime/sametime.c |   2 +-
 pidgin/gtkblist.c                       |   2 +-
 pidgin/gtkconv.c                        |  56 +++++++++++++++++---------------
 pidgin/plugins/extplacement.c           |   2 +-
 8 files changed, 49 insertions(+), 37 deletions(-)

diffs (truncated from 347 to 300 lines):

diff --git a/finch/gntconv.c b/finch/gntconv.c
--- a/finch/gntconv.c
+++ b/finch/gntconv.c
@@ -97,7 +97,7 @@ get_conversation_blist_node(PurpleConver
 	if (PURPLE_IS_IM_CONVERSATION(conv)) {
 		node = (PurpleBlistNode*)find_buddy_for_conversation(conv);
 		node = node ? purple_blist_node_get_parent(node) : NULL;
-	} else {
+	} else if (PURPLE_IS_CHAT_CONVERSATION(conv)) {
 		node = (PurpleBlistNode*)find_chat_for_conversation(conv);
 	}
 
@@ -523,8 +523,10 @@ view_log_cb(GntMenuItem *n, gpointer ggc
 
 	if (PURPLE_IS_IM_CONVERSATION(conv))
 		type = PURPLE_LOG_IM;
+	else if (PURPLE_IS_CHAT_CONVERSATION(conv))
+		type = PURPLE_LOG_CHAT;
 	else
-		type = PURPLE_LOG_CHAT;
+		return;
 
 	name = purple_conversation_get_name(conv);
 	account = purple_conversation_get_account(conv);
@@ -659,7 +661,7 @@ gg_create_menu(FinchConv *ggc)
 		}
 
 		generate_send_to_menu(ggc);
-	} else {
+	} else if (PURPLE_IS_CHAT_CONVERSATION(ggc->active_conv)) {
 		item = gnt_menuitem_new(_("Invite..."));
 		gnt_menu_add_item(GNT_MENU(sub), item);
 		gnt_menuitem_set_callback(item, invite_cb, ggc);
@@ -811,8 +813,12 @@ finch_create_conversation(PurpleConversa
 	gnt_box_set_toplevel(GNT_BOX(ggc->window), TRUE);
 	gnt_box_set_pad(GNT_BOX(ggc->window), 0);
 
-	gnt_widget_set_name(ggc->window,
-			PURPLE_IS_IM_CONVERSATION(conv) ? "conversation-window-im" : "conversation-window-chat");
+	if (PURPLE_IS_IM_CONVERSATION(conv))
+		gnt_widget_set_name(ggc->window, "conversation-window-im");
+	else if (PURPLE_IS_CHAT_CONVERSATION(conv))
+		gnt_widget_set_name(ggc->window, "conversation-window-chat");
+	else
+		gnt_widget_set_name(ggc->window, "conversation-window-other");
 
 	ggc->tv = gnt_text_view_new();
 	gnt_widget_set_name(ggc->tv, "conversation-window-textview");
diff --git a/libpurple/protocols/jabber/message.c b/libpurple/protocols/jabber/message.c
--- a/libpurple/protocols/jabber/message.c
+++ b/libpurple/protocols/jabber/message.c
@@ -910,7 +910,7 @@ jabber_conv_support_custom_smileys(Jabbe
 		} else {
 			return FALSE;
 		}
-	} else {
+	} else if (PURPLE_IS_CHAT_CONVERSATION(conv)) {
 		chat = jabber_chat_find_by_conv(PURPLE_CHAT_CONVERSATION(conv));
 		if (chat) {
 			/* do not attempt to send custom smileys in a MUC with more than
@@ -921,6 +921,8 @@ jabber_conv_support_custom_smileys(Jabbe
 		} else {
 			return FALSE;
 		}
+	} else {
+		return FALSE;
 	}
 }
 
diff --git a/libpurple/protocols/msn/switchboard.c b/libpurple/protocols/msn/switchboard.c
--- a/libpurple/protocols/msn/switchboard.c
+++ b/libpurple/protocols/msn/switchboard.c
@@ -298,7 +298,7 @@ msn_switchboard_add_user(MsnSwitchBoard 
 	{
 		msn_servconn_set_idle_timeout(swboard->servconn, 0);
 		if (swboard->conv == NULL ||
-			PURPLE_IS_IM_CONVERSATION(swboard->conv))
+			!PURPLE_IS_CHAT_CONVERSATION(swboard->conv))
 		{
 			GList *l;
 
diff --git a/libpurple/protocols/mxit/mxit.c b/libpurple/protocols/mxit/mxit.c
--- a/libpurple/protocols/mxit/mxit.c
+++ b/libpurple/protocols/mxit/mxit.c
@@ -182,7 +182,7 @@ static void mxit_cb_chat_created( Purple
 		/* not our conversation */
 		return;
 	}
-	else if ( PURPLE_IS_CHAT_CONVERSATION( conv ) ) {
+	else if ( !PURPLE_IS_IM_CONVERSATION( conv ) ) {
 		/* wrong type of conversation */
 		return;
 	}
diff --git a/libpurple/protocols/sametime/sametime.c b/libpurple/protocols/sametime/sametime.c
--- a/libpurple/protocols/sametime/sametime.c
+++ b/libpurple/protocols/sametime/sametime.c
@@ -1287,7 +1287,7 @@ static void conversation_created_cb(Purp
   if(pd->gc != gc)
     return; /* not ours */
 
-  if(PURPLE_IS_CHAT_CONVERSATION(g_conv))
+  if(!PURPLE_IS_IM_CONVERSATION(g_conv))
     return; /* wrong type */
 
   who.user = (char *) purple_conversation_get_name(g_conv);
diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c
--- a/pidgin/gtkblist.c
+++ b/pidgin/gtkblist.c
@@ -4849,7 +4849,7 @@ conversation_created_cb(PurpleConversati
 			purple_signal_connect(pidgin_conversations_get_handle(), "conversation-displayed",
 					ui, PURPLE_CALLBACK(displayed_msg_update_ui_cb), buddy);
 		}
-	} else {
+	} else if (PURPLE_IS_CHAT_CONVERSATION(conv)) {
 		PurpleChat *chat = purple_blist_find_chat(account, purple_conversation_get_name(conv));
 		struct _pidgin_blist_node *ui;
 		if (!chat)
diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c
--- a/pidgin/gtkconv.c
+++ b/pidgin/gtkconv.c
@@ -254,7 +254,7 @@ get_conversation_blist_node(PurpleConver
 	if (PURPLE_IS_IM_CONVERSATION(conv)) {
 		node = PURPLE_BLIST_NODE(purple_blist_find_buddy(account, purple_conversation_get_name(conv)));
 		node = node ? node->parent : NULL;
-	} else {
+	} else if (PURPLE_IS_CHAT_CONVERSATION(conv)) {
 		node = PURPLE_BLIST_NODE(purple_blist_find_chat(account, purple_conversation_get_name(conv)));
 	}
 
@@ -292,7 +292,7 @@ close_conv_cb(GtkButton *button, PidginC
 			close_this_sucker(gtkconv);
 		else
 			hide_conv(gtkconv, TRUE);
-	} else {
+	} else if (PURPLE_IS_CHAT_CONVERSATION(conv)) {
 		PurpleChat *chat = purple_blist_find_chat(account, name);
 		if (!chat ||
 				!purple_blist_node_get_bool(&chat->node, "gtk-persistent"))
@@ -704,7 +704,7 @@ add_remove_cb(GtkWidget *widget, PidginC
 			pidgin_dialogs_remove_buddy(b);
 		else if (account != NULL && purple_account_is_connected(account))
 			purple_blist_request_add_buddy(account, (char *)name, NULL, NULL);
-	} else {
+	} else if (PURPLE_IS_CHAT_CONVERSATION(conv)) {
 		PurpleChat *c;
 
 		c = purple_blist_find_chat(account, name);
@@ -737,7 +737,7 @@ info_cb(GtkWidget *widget, PidginConvers
 		pidgin_retrieve_user_info(purple_conversation_get_connection(conv),
 					  purple_conversation_get_name(conv));
 		gtk_widget_grab_focus(gtkconv->entry);
-	} else {
+	} else if (PURPLE_IS_CHAT_CONVERSATION(conv)) {
 		/* Get info of the person currently selected in the GtkTreeView */
 		PidginChatPane *gtkchat;
 		GtkTreeIter iter;
@@ -1136,7 +1136,13 @@ menu_view_log_cb(GtkAction *action, gpoi
 	GSList *cur;
 
 	conv = pidgin_conv_window_get_active_conversation(win);
-	type = PURPLE_IS_IM_CONVERSATION(conv) ? PURPLE_LOG_IM : PURPLE_LOG_CHAT;
+
+	if (PURPLE_IS_IM_CONVERSATION(conv))
+		type = PURPLE_LOG_IM;
+	else if (PURPLE_IS_CHAT_CONVERSATION(conv))
+		type = PURPLE_LOG_CHAT;
+	else
+		return;
 
 	gtkblist = pidgin_blist_get_default_gtk_blist();
 
@@ -1288,7 +1294,7 @@ menu_alias_cb(GtkAction *action, gpointe
 		b = purple_blist_find_buddy(account, name);
 		if (b != NULL)
 			pidgin_dialogs_alias_buddy(b);
-	} else {
+	} else if (PURPLE_IS_CHAT_CONVERSATION(conv)) {
 		PurpleChat *c;
 
 		c = purple_blist_find_chat(account, name);
@@ -1441,7 +1447,7 @@ menu_logging_cb(GtkAction *action, gpoin
 			purple_blist_node_remove_setting(node, "enable-logging");
 		else
 			purple_blist_node_set_bool(node, "enable-logging", logging);
-	} else {
+	} else if (PURPLE_IS_CHAT_CONVERSATION(conv)) {
 		if (logging == purple_prefs_get_bool("/purple/logging/log_chats"))
 			purple_blist_node_remove_setting(node, "enable-logging");
 		else
@@ -2648,7 +2654,7 @@ update_tab_icon(PurpleConversation *conv
 	gtk_widget_queue_draw(gtkconv->infopane);
 
 	if (pidgin_conv_window_is_active_conversation(conv) &&
-		(PURPLE_IS_CHAT_CONVERSATION(conv) || gtkconv->u.im->anim == NULL))
+		(!PURPLE_IS_IM_CONVERSATION(conv) || gtkconv->u.im->anim == NULL))
 	{
 		l = pidgin_conv_get_tab_icons(conv);
 
@@ -5802,7 +5808,7 @@ buddy_update_cb(PurpleBlistNode *bnode, 
 		PidginWindow *win = list->data;
 		PurpleConversation *conv = pidgin_conv_window_get_active_conversation(win);
 
-		if (PURPLE_IS_CHAT_CONVERSATION(conv))
+		if (!PURPLE_IS_IM_CONVERSATION(conv))
 			continue;
 
 		pidgin_conv_update_fields(conv, PIDGIN_CONV_MENU);
@@ -5867,13 +5873,12 @@ private_gtkconv_new(PurpleConversation *
 	PidginConversation *gtkconv;
 	const char *theme_name;
 	PurpleTheme *theme = NULL;
-	gboolean is_chat = PURPLE_IS_CHAT_CONVERSATION(conv);
 	GtkWidget *pane = NULL;
 	GtkWidget *tab_cont;
 	PurpleBlistNode *convnode;
 	GtkTargetList *targets;
 
-	if (!is_chat && (gtkconv = pidgin_conv_find_gtkconv(conv))) {
+	if (PURPLE_IS_IM_CONVERSATION(conv) && (gtkconv = pidgin_conv_find_gtkconv(conv))) {
 		purple_conversation_set_ui_data(conv, gtkconv);
 		if (!g_list_find(gtkconv->convs, conv))
 			gtkconv->convs = g_list_prepend(gtkconv->convs, conv);
@@ -5898,18 +5903,17 @@ private_gtkconv_new(PurpleConversation *
 	gtkconv->theme = PIDGIN_CONV_THEME(g_object_ref(theme));
 	gtkconv->last_flags = 0;
 
-
-	if (!is_chat) {
+	if (PURPLE_IS_IM_CONVERSATION(conv)) {
 		gtkconv->u.im = g_malloc0(sizeof(PidginImPane));
-	} else {
+	} else if (PURPLE_IS_CHAT_CONVERSATION(conv)) {
 		gtkconv->u.chat = g_malloc0(sizeof(PidginChatPane));
 	}
 	pane = setup_common_pane(gtkconv);
 
 	if (pane == NULL) {
-		if (is_chat)
+		if (PURPLE_IS_CHAT_CONVERSATION(conv))
 			g_free(gtkconv->u.chat);
-		else
+		else if (PURPLE_IS_IM_CONVERSATION(conv))
 			g_free(gtkconv->u.im);
 
 		g_free(gtkconv);
@@ -6101,7 +6105,7 @@ pidgin_conv_destroy(PurpleConversation *
 			g_source_remove(gtkconv->u.im->typing_timer);
 
 		g_free(gtkconv->u.im);
-	} else {
+	} else if (PURPLE_IS_CHAT_CONVERSATION(conv)) {
 		purple_signals_disconnect_by_handle(gtkconv->u.chat);
 		g_free(gtkconv->u.chat);
 	}
@@ -7314,7 +7318,7 @@ gray_stuff_out(PidginConversation *gtkco
 
 		gtk_action_set_visible(win->menu->insert_link, TRUE);
 		gtk_action_set_visible(win->menu->insert_image, TRUE);
-	} else {
+	} else if (PURPLE_IS_CHAT_CONVERSATION(conv)) {
 		/* Show stuff that applies to Chats, hide stuff that applies to IMs */
 
 		/* Deal with menu items */
@@ -7347,7 +7351,7 @@ gray_stuff_out(PidginConversation *gtkco
 	 * and what features that account supports.
 	 */
 	if ((gc != NULL) &&
-		(PURPLE_IS_IM_CONVERSATION(conv) ||
+		(!PURPLE_IS_CHAT_CONVERSATION(conv) ||
 		 !purple_chat_conversation_has_left(PURPLE_CHAT_CONVERSATION(conv)) ))
 	{
 		PurpleConnectionFlags features = purple_conversation_get_features(conv);
@@ -7408,7 +7412,7 @@ gray_stuff_out(PidginConversation *gtkco
 									 (account != NULL) &&
 									 (purple_blist_find_buddy(account, purple_conversation_get_name(conv)) != NULL));
 		}
-		else
+		else if (PURPLE_IS_CHAT_CONVERSATION(conv))
 		{
 			gtk_action_set_sensitive(win->menu->add, (PURPLE_PROTOCOL_IMPLEMENTS(protocol, CHAT_IFACE, join)));
 			gtk_action_set_sensitive(win->menu->remove, (PURPLE_PROTOCOL_IMPLEMENTS(protocol, CHAT_IFACE, join)));
@@ -8607,7 +8611,7 @@ gboolean pidgin_conv_attach_to_conversat
 			list = g_list_sort(list, message_compare);
 			gtkconv->attach_current = list;
 			list = g_list_last(list);
-		} else {
+		} else if (PURPLE_IS_CHAT_CONVERSATION(conv)) {
 			gtkconv->attach_current = g_list_last(list);
 		}
 	
@@ -9646,7 +9650,7 @@ before_switch_conv_cb(GtkNotebook *noteb
 
 	g_return_if_fail(conv != NULL);
 
-	if (PURPLE_IS_CHAT_CONVERSATION(conv))
+	if (!PURPLE_IS_IM_CONVERSATION(conv))
 		return;
 
 	gtkconv = PIDGIN_CONVERSATION(conv);
@@ -9871,7 +9875,7 @@ alias_cb(GtkEntry *entry, gpointer user_



More information about the Commits mailing list