Mercurial > pidgin
changeset 28941:9cdf9bc6c1ed
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.
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Wed, 03 Feb 2010 04:45:38 +0000 |
parents | 4d50162d809e |
children | b65311c73adc |
files | libpurple/protocols/jabber/jabber.c |
diffstat | 1 files changed, 14 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/jabber/jabber.c Wed Feb 03 01:03:09 2010 +0000 +++ b/libpurple/protocols/jabber/jabber.c Wed Feb 03 04:45:38 2010 +0000 @@ -356,11 +356,20 @@ } 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)