pidgin: 6b259eee: Rejoin an opened chat after an account r...

sadrul at pidgin.im sadrul at pidgin.im
Wed Oct 21 19:30:40 EDT 2009


-----------------------------------------------------------------
Revision: 6b259eeeb98687f0750c2dc07e41bcdec6ca3ef8
Ancestor: 0d33eae1cfd57cb5f459518ad5db14230f13792b
Author: sadrul at pidgin.im
Date: 2009-10-21T23:26:41
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/6b259eeeb98687f0750c2dc07e41bcdec6ca3ef8

Modified files:
        ChangeLog finch/gntconn.c finch/gntconv.c pidgin/gtkconn.c
        pidgin/gtkconv.c

ChangeLog: 

Rejoin an opened chat after an account reconnects.

Previously, we used to rejoin an open chat only if the account was
disconnected due to an error. But now, the chat rooms will be rejoined
even if we disconnected manually.

-------------- next part --------------
============================================================
--- ChangeLog	46662025cdef2c5fcd55bb874fea6b4fb520d627
+++ ChangeLog	62ae72f47748eaa6e3fb1a5b9c0115efee13a829
@@ -9,6 +9,7 @@ version 2.6.4 (??/??/20??):
 	  to announce the list of loaded plugins (in both Finch and Pidgin).
 	* Fix building the GnuTLS plugin with older versions of GnuTLS.
 	* Fix DNS TXT query resolution.
+	* Always rejoin open chats after an account reconnects.
 
 	MSN:
 	* Don't forget display names for buddies.
============================================================
--- finch/gntconn.c	4e8ab3c05ad02740db8b3ed1b3edccfc30a9023a
+++ finch/gntconn.c	f52afca39efc4664fff4c4dfbd5959ea580c4f32
@@ -107,7 +107,6 @@ finch_connection_report_disconnect(Purpl
 {
 	FinchAutoRecon *info;
 	PurpleAccount *account = purple_connection_get_account(gc);
-	GList *list;
 
 	if (!purple_connection_error_is_fatal(reason)) {
 		info = g_hash_table_lookup(hash, account);
@@ -144,21 +143,6 @@ finch_connection_report_disconnect(Purpl
 		g_free(secondary);
 		purple_account_set_enabled(account, FINCH_UI, FALSE);
 	}
-
-	/* If we have any open chats, we probably want to rejoin when we get back online. */
-	list = purple_get_chats();
-	while (list) {
-		PurpleConversation *conv = list->data;
-		list = list->next;
-		if (purple_conversation_get_account(conv) != account ||
-				purple_conv_chat_has_left(PURPLE_CONV_CHAT(conv)))
-			continue;
-		purple_conversation_set_data(conv, "want-to-rejoin", GINT_TO_POINTER(TRUE));
-		purple_conversation_write(conv, NULL, _("The account has disconnected and you are no "
-					"longer in this chat. You will be automatically rejoined in the chat when "
-					"the account reconnects."),
-				PURPLE_MESSAGE_SYSTEM, time(NULL));
-	}
 }
 
 static void
============================================================
--- finch/gntconv.c	dbf23751ae534112e5d0b41136c1325efb9eef03
+++ finch/gntconv.c	d4624b1133fb33ea63738d27715bee520511498c
@@ -367,6 +367,26 @@ account_signed_on_off(PurpleConnection *
 	}
 }
 
+static void
+account_signing_off(PurpleConnection *gc)
+{
+	GList *list = purple_get_chats();
+
+	/* We are about to sign off. See which chats we are currently in, and mark
+	 * them for rejoin on reconnect. */
+	while (list) {
+		PurpleConversation *conv = list->data;
+		if (!purple_conv_chat_has_left(PURPLE_CONV_CHAT(conv))) {
+			purple_conversation_set_data(conv, "want-to-rejoin", GINT_TO_POINTER(TRUE));
+			purple_conversation_write(conv, NULL, _("The account has disconnected and you are no "
+						"longer in this chat. You will be automatically rejoined in the chat when "
+						"the account reconnects."),
+					PURPLE_MESSAGE_SYSTEM, time(NULL));
+		}
+		list = list->next;
+	}
+}
+
 static gpointer
 finch_conv_get_handle(void)
 {
@@ -1433,6 +1453,8 @@ void finch_conversation_init()
 					PURPLE_CALLBACK(account_signed_on_off), NULL);
 	purple_signal_connect(purple_connections_get_handle(), "signed-off", finch_conv_get_handle(),
 					PURPLE_CALLBACK(account_signed_on_off), NULL);
+	purple_signal_connect(purple_connections_get_handle(), "signing-off", finch_conv_get_handle(),
+					PURPLE_CALLBACK(account_signing_off), NULL);
 }
 
 void finch_conversation_uninit()
============================================================
--- pidgin/gtkconn.c	9c65425207fe72d7140bc9bb166988997c257d45
+++ pidgin/gtkconn.c	03e3f77c4205f96e2156f994175896d60374bee1
@@ -142,7 +142,6 @@ pidgin_connection_report_disconnect_reas
 {
 	PurpleAccount *account = NULL;
 	PidginAutoRecon *info;
-	GList *list;
 
 	account = purple_connection_get_account(gc);
 	info = g_hash_table_lookup(auto_reconns, account);
@@ -164,17 +163,6 @@ pidgin_connection_report_disconnect_reas
 
 		purple_account_set_enabled(account, PIDGIN_UI, FALSE);
 	}
-
-	/* If we have any open chats, we probably want to rejoin when we get back online. */
-	list = purple_get_chats();
-	while (list) {
-		PurpleConversation *conv = list->data;
-		list = list->next;
-		if (conv->account != account ||
-				purple_conv_chat_has_left(PURPLE_CONV_CHAT(conv)))
-			continue;
-		purple_conversation_set_data(conv, "want-to-rejoin", GINT_TO_POINTER(TRUE));
-	}
 }
 
 static void pidgin_connection_network_connected (void)
============================================================
--- pidgin/gtkconv.c	218b01f6ce78be26c7029257b6e970d2de48d95f
+++ pidgin/gtkconv.c	a23c10e22d9d7cea516f985d4fe5c68d0d7399f7
@@ -4277,7 +4277,7 @@ tab_complete(PurpleConversation *conv)
 		/* Users */
 		for (; l != NULL; l = l->next) {
 			tab_complete_process_item(&most_matched, entered, entered_bytes, &partial, nick_partial,
-									  &matches, TRUE, ((PurpleConvChatBuddy *)l->data)->name);
+									  &matches, FALSE, ((PurpleConvChatBuddy *)l->data)->name);
 		}
 
 
@@ -7601,6 +7601,26 @@ account_signed_off_cb(PurpleConnection *
 	}
 }
 
+static void
+account_signing_off(PurpleConnection *gc)
+{
+	GList *list = purple_get_chats();
+
+	/* We are about to sign off. See which chats we are currently in, and mark
+	 * them for rejoin on reconnect. */
+	while (list) {
+		PurpleConversation *conv = list->data;
+		if (!purple_conv_chat_has_left(PURPLE_CONV_CHAT(conv))) {
+			purple_conversation_set_data(conv, "want-to-rejoin", GINT_TO_POINTER(TRUE));
+			purple_conversation_write(conv, NULL, _("The account has disconnected and you are no "
+						"longer in this chat. You will be automatically rejoined in the chat when "
+						"the account reconnects."),
+					PURPLE_MESSAGE_SYSTEM, time(NULL));
+		}
+		list = list->next;
+	}
+}
+
 static gboolean
 update_buddy_status_timeout(PurpleBuddy *buddy)
 {
@@ -8095,6 +8115,8 @@ pidgin_conversations_init(void)
 	purple_signal_connect(purple_connections_get_handle(), "signed-off", handle,
 						G_CALLBACK(account_signed_off_cb),
 						GINT_TO_POINTER(PURPLE_CONV_ACCOUNT_OFFLINE));
+	purple_signal_connect(purple_connections_get_handle(), "signing-off", handle,
+						G_CALLBACK(account_signing_off), NULL);
 
 	purple_signal_connect(purple_conversations_get_handle(), "received-im-msg",
 						handle, G_CALLBACK(received_im_msg_cb), NULL);


More information about the Commits mailing list