changeset 23284:af23a35234b9

merge of '5e69fb5f354ed74d6deb6f4d1f6aff46afd8a072' and '6560ae1eff40239f99f3ea8c8e93c28572295399'
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Wed, 04 Jun 2008 22:50:40 +0000
parents ea998456c3bd (current diff) a601807bae2b (diff)
children eb27ae817284
files
diffstat 1 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/finch/gntblist.c	Wed Jun 04 03:22:36 2008 +0000
+++ b/finch/gntblist.c	Wed Jun 04 22:50:40 2008 +0000
@@ -2722,6 +2722,7 @@
 	PurpleConnection *gc;
 	PurpleChat *chat;
 	GHashTable *hash = NULL;
+	PurpleConversation *conv;
 
 	account = purple_request_fields_get_account(fields, "account");
 	name = purple_request_fields_get_string(fields,  "chat");
@@ -2730,7 +2731,16 @@
 		return;
 
 	gc = purple_account_get_connection(account);
-	purple_conversation_new(PURPLE_CONV_TYPE_CHAT, account, name);
+	/* Create a new conversation now. This will give focus to the new window.
+	 * But it's necessary to pretend that we left the chat, because otherwise
+	 * a new conversation window will pop up when we finally join the chat. */
+	if (!(conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, name, account))) {
+		conv = purple_conversation_new(PURPLE_CONV_TYPE_CHAT, account, name);
+		purple_conv_chat_left(PURPLE_CONV_CHAT(conv));
+	} else {
+		purple_conversation_present(conv);
+	}
+
 	chat = purple_blist_find_chat(account, name);
 	if (chat == NULL) {
 		PurplePluginProtocolInfo *info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc));