comparison libpurple/protocols/jabber/jabber.c @ 29331: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 4189f9e1627b
children b65311c73adc
comparison
equal deleted inserted replaced
29329:4d50162d809e 29331:9cdf9bc6c1ed
354 ret = -1; 354 ret = -1;
355 errno = EAGAIN; 355 errno = EAGAIN;
356 } 356 }
357 357
358 if (ret < 0 && errno != EAGAIN) { 358 if (ret < 0 && errno != EAGAIN) {
359 gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"), 359 PurpleAccount *account = purple_connection_get_account(js->gc);
360 g_strerror(errno)); 360 /*
361 purple_connection_error_reason(js->gc, 361 * The server may have closed the socket (on a stream error), so if
362 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); 362 * we're disconnecting, don't generate (possibly another) error that
363 g_free(tmp); 363 * (for some UIs) would mask the first.
364 */
365 if (!account->disconnecting) {
366 gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"),
367 g_strerror(errno));
368 purple_connection_error_reason(js->gc,
369 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp);
370 g_free(tmp);
371 }
372
364 success = FALSE; 373 success = FALSE;
365 } else if (ret < len) { 374 } else if (ret < len) {
366 if (ret < 0) 375 if (ret < 0)
367 ret = 0; 376 ret = 0;
368 if (js->writeh == 0) 377 if (js->writeh == 0)