changeset 17487:1873848dfddb

Make the Conversation->More menu work for Chats. The chat needs to be on your buddy list for this to work. Creating a transient PurpleChat blist node for generating the menu for chats not on the buddy list does not work well because the menu item callbacks expect the node to still exist.
author Stu Tomlinson <stu@nosnilmot.com>
date Mon, 04 Jun 2007 16:18:34 +0000
parents ac504f643092
children 7e856734b712 a2c36e2010f1
files pidgin/gtkconv.c
diffstat 1 files changed, 16 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/gtkconv.c	Mon Jun 04 14:31:08 2007 +0000
+++ b/pidgin/gtkconv.c	Mon Jun 04 16:18:34 2007 +0000
@@ -2897,14 +2897,25 @@
 	GList *list;
 	PidginConversation *gtkconv;
 	PurpleConversation *conv;
-	PurpleBuddy *buddy;
+	PurpleBlistNode *node = NULL;
+	PurpleChat *chat = NULL;
+	PurpleBuddy *buddy = NULL;
 
 	gtkconv = pidgin_conv_window_get_active_gtkconv(win);
 	conv = gtkconv->active_conv;
-	buddy = purple_find_buddy(conv->account, conv->name);
 
 	menu = gtk_item_factory_get_widget(win->menu.item_factory, N_("/Conversation/More"));
 
+	if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT)
+		chat = purple_blist_find_chat(conv->account, conv->name);
+	else
+		buddy = purple_find_buddy(conv->account, conv->name);
+
+	if (chat)
+		node = (PurpleBlistNode *)chat;
+	else if (buddy)
+		node = (PurpleBlistNode *)buddy;
+
 	/* Remove the previous entries */
 	for (list = gtk_container_get_children(GTK_CONTAINER(menu)); list; )
 	{
@@ -2914,12 +2925,11 @@
 	}
 
 	/* Now add the stuff */
-	if (buddy)
+	if (node)
 	{
 		if (purple_account_is_connected(conv->account))
-			pidgin_append_blist_node_proto_menu(menu, conv->account->gc,
-												  (PurpleBlistNode *)buddy);
-		pidgin_append_blist_node_extended_menu(menu, (PurpleBlistNode *)buddy);
+			pidgin_append_blist_node_proto_menu(menu, conv->account->gc, node);
+		pidgin_append_blist_node_extended_menu(menu, node);
 	}
 
 	if ((list = gtk_container_get_children(GTK_CONTAINER(menu))) == NULL)