Merged soc.2013.gobjectification branch soc.2013.gobjectification.plugins

Mon, 18 Nov 2013 00:03:23 +0530

author
Ankit Vani <a@nevitus.org>
date
Mon, 18 Nov 2013 00:03:23 +0530
branch
soc.2013.gobjectification.plugins
changeset 36956
4808d6391e69
parent 36955
de491fc3f726 (current diff)
parent 35070
d7350d876fda (diff)
child 36957
95cfd176b193

Merged soc.2013.gobjectification branch

finch/gntconv.c file | annotate | diff | comparison | revisions
libpurple/protocols/jabber/message.c file | annotate | diff | comparison | revisions
libpurple/protocols/mxit/mxit.c file | annotate | diff | comparison | revisions
libpurple/protocols/sametime/sametime.c file | annotate | diff | comparison | revisions
pidgin/gtkblist.c file | annotate | diff | comparison | revisions
pidgin/gtkconv.c file | annotate | diff | comparison | revisions
pidgin/plugins/extplacement.c file | annotate | diff | comparison | revisions
--- a/finch/gntconv.c	Sun Nov 17 20:23:45 2013 +0530
+++ b/finch/gntconv.c	Mon Nov 18 00:03:23 2013 +0530
@@ -97,7 +97,7 @@
 	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 @@
 
 	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 @@
 		}
 
 		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 @@
 	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");
--- a/libpurple/protocols/jabber/message.c	Sun Nov 17 20:23:45 2013 +0530
+++ b/libpurple/protocols/jabber/message.c	Mon Nov 18 00:03:23 2013 +0530
@@ -910,7 +910,7 @@
 		} 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 @@
 		} else {
 			return FALSE;
 		}
+	} else {
+		return FALSE;
 	}
 }
 
--- a/libpurple/protocols/msn/switchboard.c	Sun Nov 17 20:23:45 2013 +0530
+++ b/libpurple/protocols/msn/switchboard.c	Mon Nov 18 00:03:23 2013 +0530
@@ -298,7 +298,7 @@
 	{
 		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;
 
--- a/libpurple/protocols/mxit/mxit.c	Sun Nov 17 20:23:45 2013 +0530
+++ b/libpurple/protocols/mxit/mxit.c	Mon Nov 18 00:03:23 2013 +0530
@@ -182,7 +182,7 @@
 		/* not our conversation */
 		return;
 	}
-	else if ( PURPLE_IS_CHAT_CONVERSATION( conv ) ) {
+	else if ( !PURPLE_IS_IM_CONVERSATION( conv ) ) {
 		/* wrong type of conversation */
 		return;
 	}
--- a/libpurple/protocols/sametime/sametime.c	Sun Nov 17 20:23:45 2013 +0530
+++ b/libpurple/protocols/sametime/sametime.c	Mon Nov 18 00:03:23 2013 +0530
@@ -1287,7 +1287,7 @@
   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);
--- a/pidgin/gtkblist.c	Sun Nov 17 20:23:45 2013 +0530
+++ b/pidgin/gtkblist.c	Mon Nov 18 00:03:23 2013 +0530
@@ -4849,7 +4849,7 @@
 			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)
--- a/pidgin/gtkconv.c	Sun Nov 17 20:23:45 2013 +0530
+++ b/pidgin/gtkconv.c	Mon Nov 18 00:03:23 2013 +0530
@@ -254,7 +254,7 @@
 	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_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 @@
 			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 @@
 		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 @@
 	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 @@
 		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 @@
 			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 @@
 	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 @@
 		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 @@
 	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 @@
 	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 @@
 			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 @@
 
 		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 @@
 	 * 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 @@
 									 (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 @@
 			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 @@
 
 	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 @@
 			purple_buddy_set_local_alias(buddy, gtk_entry_get_text(entry));
 		}
 		serv_alias_buddy(buddy);
-	} else {
+	} else if (PURPLE_IS_CHAT_CONVERSATION(conv)) {
 		gtk_entry_set_text(GTK_ENTRY(gtkconv->u.chat->topic_text), gtk_entry_get_text(entry));
 		topic_callback(NULL, gtkconv);
 	}
@@ -9902,7 +9906,7 @@
 			return FALSE;
 
 		text = purple_buddy_get_contact_alias(buddy);
-	} else {
+	} else if (PURPLE_IS_CHAT_CONVERSATION(conv)) {
 		PurpleConnection *gc;
 		PurpleProtocol *protocol = NULL;
 
@@ -10842,7 +10846,7 @@
 		purple_prefs_set_int(PIDGIN_PREFS_ROOT "/conversations/im/y", y);
 		purple_prefs_set_int(PIDGIN_PREFS_ROOT "/conversations/im/width",  event->width);
 		purple_prefs_set_int(PIDGIN_PREFS_ROOT "/conversations/im/height", event->height);
-	} else {
+	} else if (PURPLE_IS_CHAT_CONVERSATION(conv->active_conv)) {
 		purple_prefs_set_int(PIDGIN_PREFS_ROOT "/conversations/chat/x", x);
 		purple_prefs_set_int(PIDGIN_PREFS_ROOT "/conversations/chat/y", y);
 		purple_prefs_set_int(PIDGIN_PREFS_ROOT "/conversations/chat/width",  event->width);
@@ -10919,7 +10923,7 @@
 		if (buddy != NULL)
 			group = purple_buddy_get_group(buddy);
 
-	} else {
+	} else if (PURPLE_IS_CHAT_CONVERSATION(conv->active_conv)) {
 		PurpleChat *chat;
 
 		chat = purple_blist_find_chat(purple_conversation_get_account(conv->active_conv),
--- a/pidgin/plugins/extplacement.c	Sun Nov 17 20:23:45 2013 +0530
+++ b/pidgin/plugins/extplacement.c	Mon Nov 18 00:03:23 2013 +0530
@@ -58,7 +58,7 @@
 				win = l->data;
 
 				if (purple_prefs_get_bool("/plugins/gtk/extplacement/placement_number_separate") &&
-					PURPLE_IS_IM_CONVERSATION(pidgin_conv_window_get_active_conversation(win)) != PURPLE_IS_IM_CONVERSATION(conv->active_conv))
+					G_TYPE_FROM_INSTANCE(pidgin_conv_window_get_active_conversation(win)) != G_TYPE_FROM_INSTANCE(conv->active_conv))
 					continue;
 
 				count = pidgin_conv_window_get_gtkconv_count(win);

mercurial