pidgin: 6560ae1e: Fix chat joining from the 'Join a chat' ...

sadrul at pidgin.im sadrul at pidgin.im
Wed Jun 4 18:50:47 EDT 2008


-----------------------------------------------------------------
Revision: 6560ae1eff40239f99f3ea8c8e93c28572295399
Ancestor: 983c6951e2b49e31fbe1c5f0adc5bcadd9064166
Author: sadrul at pidgin.im
Date: 2008-06-04T22:49:23
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/6560ae1eff40239f99f3ea8c8e93c28572295399

Modified files:
        finch/gntblist.c

ChangeLog: 

Fix chat joining from the 'Join a chat' dialog. Thanks to w00b on IRC for
reporting the bug.

-------------- next part --------------
============================================================
--- finch/gntblist.c	aae68a3c1e5fb7c9db0585da66c5aa3a69600f75
+++ finch/gntblist.c	9c3de6e5483669e3038686979d484d1ea6602574
@@ -2722,6 +2722,7 @@ join_chat_select_cb(gpointer data, Purpl
 	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 @@ join_chat_select_cb(gpointer data, Purpl
 		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));


More information about the Commits mailing list