pidgin: 5a93a894: jabber: When doing writes while disconne...

darkrain42 at pidgin.im darkrain42 at pidgin.im
Tue Feb 2 23:51:23 EST 2010


-----------------------------------------------------------------
Revision: 5a93a894687983dbd616039fc88e13552865c93a
Ancestor: c98a0a224b48d68f530d5fdc5d306ac735c87e0d
Author: darkrain42 at pidgin.im
Date: 2010-02-03T04:45:38
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/5a93a894687983dbd616039fc88e13552865c93a

Modified files:
        libpurple/protocols/jabber/jabber.c

ChangeLog: 

jabber: When doing writes while disconnecting, 'ignore' errors.

In some UIs (Adium and I believe Pidgin), the UI could end up displaying
"Lost Connection to Server" instead of (e.g.) "Resource conflict", which
masks the actual issue.

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/jabber.c	5fde4cbdc6997b36bb527279de58f6431618ea12
+++ libpurple/protocols/jabber/jabber.c	c09ff2ecbb4eb174adf5f82c2087c4e2f1bbc578
@@ -356,11 +356,20 @@ static gboolean do_jabber_send_raw(Jabbe
 	}
 
 	if (ret < 0 && errno != EAGAIN) {
-		gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"),
-				g_strerror(errno));
-		purple_connection_error_reason(js->gc,
-			PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp);
-		g_free(tmp);
+		PurpleAccount *account = purple_connection_get_account(js->gc);
+		/*
+		 * The server may have closed the socket (on a stream error), so if
+		 * we're disconnecting, don't generate (possibly another) error that
+		 * (for some UIs) would mask the first.
+		 */
+		if (!account->disconnecting) {
+			gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"),
+					g_strerror(errno));
+			purple_connection_error_reason(js->gc,
+				PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp);
+			g_free(tmp);
+		}
+
 		success = FALSE;
 	} else if (ret < len) {
 		if (ret < 0)


More information about the Commits mailing list