changeset 12576:1246935dd047

[gaim-migrate @ 14898] Attempting to join a chat you're already in should present the chat. committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Tue, 20 Dec 2005 09:35:56 +0000
parents 9b0187ba0ec0
children f1ee8a29bd69
files src/gtkblist.c
diffstat 1 files changed, 20 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/gtkblist.c	Tue Dec 20 07:07:53 2005 +0000
+++ b/src/gtkblist.c	Tue Dec 20 09:35:56 2005 +0000
@@ -270,9 +270,23 @@
 			gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w)));
 }
 
+static void gtk_blist_join_chat(GaimChat *chat)
+{
+	GaimConversation *conv;
+
+	conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_CHAT,
+											   gaim_chat_get_name(chat),
+											   chat->account);
+
+	if (conv != NULL)
+		gaim_gtkconv_present_conversation(conv);
+	else
+		serv_join_chat(chat->account->gc, chat->components);
+}
+
 static void gtk_blist_menu_join_cb(GtkWidget *w, GaimChat *chat)
 {
-	serv_join_chat(chat->account->gc, chat->components);
+	gtk_blist_join_chat(chat);
 }
 
 static void gtk_blist_renderer_edited_cb(GtkCellRendererText *text_rend, char *arg1,
@@ -434,6 +448,7 @@
 		GHashTable *components =
 			g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
 		GList *tmp;
+		GaimChat *chat;
 
 		for (tmp = data->entries; tmp != NULL; tmp = tmp->next)
 		{
@@ -452,9 +467,9 @@
 			}
 		}
 
-		serv_join_chat(gaim_account_get_connection(data->account), components);
-
-		g_hash_table_destroy(components);
+		chat = gaim_chat_new(data->account, NULL, components);
+		gtk_blist_join_chat(chat);
+		gaim_blist_remove_chat(chat);
 	}
 }
 
@@ -768,7 +783,7 @@
 
 		gaim_gtkdialogs_im_with_user(buddy->account, buddy->name);
 	} else if (GAIM_BLIST_NODE_IS_CHAT(node)) {
-		serv_join_chat(((GaimChat *)node)->account->gc, ((GaimChat *)node)->components);
+		gtk_blist_join_chat((GaimChat *)node);
 	} else if (GAIM_BLIST_NODE_IS_GROUP(node)) {
 		if (gtk_tree_view_row_expanded(tv, path))
 			gtk_tree_view_collapse_row(tv, path);