changeset 16286:3974d12a56ec

Fix ignore in chats when using right-click on a nick in the conversation window instead of the chat users list. Fixes #227
author Stu Tomlinson <stu@nosnilmot.com>
date Sat, 21 Apr 2007 14:02:48 +0000
parents 7125eda8fe22
children 5f536fc60d14
files pidgin/gtkconv.c
diffstat 1 files changed, 9 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/gtkconv.c	Sat Apr 21 13:37:44 2007 +0000
+++ b/pidgin/gtkconv.c	Sat Apr 21 14:02:48 2007 +0000
@@ -1416,35 +1416,19 @@
 	g_free(real_who);
 }
 
+static void pidgin_conv_chat_update_user(PurpleConversation *conv, const char *user);
+
 static void
 ignore_cb(GtkWidget *w, PidginConversation *gtkconv)
 {
 	PurpleConversation *conv = gtkconv->active_conv;
-	PidginChatPane *gtkchat;
-	PurpleConvChatBuddy *cbuddy;
 	PurpleConvChat *chat;
-	PurpleConvChatBuddyFlags flags;
-	GtkTreeIter iter;
-	GtkTreeModel *model;
-	GtkTreeSelection *sel;
-	char *name;
-	char *alias;
-
-	chat    = PURPLE_CONV_CHAT(conv);
-	gtkchat = gtkconv->u.chat;
-
-	model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list));
-	sel   = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list));
-
-	if (gtk_tree_selection_get_selected(sel, NULL, &iter)) {
-		gtk_tree_model_get(GTK_TREE_MODEL(model), &iter,
-						   CHAT_USERS_NAME_COLUMN, &name,
-						   CHAT_USERS_ALIAS_COLUMN, &alias,
-						   CHAT_USERS_FLAGS_COLUMN, &flags,
-						   -1);
-		gtk_list_store_remove(GTK_LIST_STORE(model), &iter);
-	}
-	else
+	const char *name;
+
+	chat = PURPLE_CONV_CHAT(conv);
+	name = g_object_get_data(G_OBJECT(w), "user_data");
+
+	if (name == NULL)
 		return;
 
 	if (purple_conv_chat_is_user_ignored(chat, name))
@@ -1452,11 +1436,7 @@
 	else
 		purple_conv_chat_ignore(chat, name);
 
-	cbuddy = purple_conv_chat_cb_new(name, alias, flags);
-
-	add_chat_buddy_common(conv, cbuddy, NULL);
-	g_free(name);
-	g_free(alias);
+	pidgin_conv_chat_update_user(conv, name);
 }
 
 static void