comparison libpurple/protocols/yahoo/ycht.c @ 27381:f541583e31bd

More uniformity among disconnect error messages
author Mark Doliner <mark@kingant.net>
date Mon, 06 Jul 2009 09:07:42 +0000
parents 377e063ecda5
children 09772222714a
comparison
equal deleted inserted replaced
27380:1bbed9fd046b 27381:f541583e31bd
283 if (ret < 0 && errno == EAGAIN) 283 if (ret < 0 && errno == EAGAIN)
284 return; 284 return;
285 else if (ret <= 0) { 285 else if (ret <= 0) {
286 /* TODO: error handling */ 286 /* TODO: error handling */
287 /* 287 /*
288 gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"),
289 g_strerror(errno));
288 purple_connection_error_reason(purple_account_get_connection(irc->account), 290 purple_connection_error_reason(purple_account_get_connection(irc->account),
289 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, 291 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp);
290 _("Server has disconnected")); 292 g_free(tmp);
291 */ 293 */
292 return; 294 return;
293 } 295 }
294 296
295 purple_circ_buffer_mark_read(ycht->txbuf, ret); 297 purple_circ_buffer_mark_read(ycht->txbuf, ret);
452 } 454 }
453 455
454 static void ycht_connection_error(YchtConn *ycht, const gchar *error) 456 static void ycht_connection_error(YchtConn *ycht, const gchar *error)
455 { 457 {
456 458
457 purple_notify_info(ycht->gc, NULL, _("Connection problem with the YCHT server."), error); 459 purple_notify_info(ycht->gc, NULL, _("Connection problem with the YCHT server"), error);
458 ycht_connection_close(ycht); 460 ycht_connection_close(ycht);
459 } 461 }
460 462
461 static void ycht_pending(gpointer data, gint source, PurpleInputCondition cond) 463 static void ycht_pending(gpointer data, gint source, PurpleInputCondition cond)
462 { 464 {
471 473
472 if (errno == EAGAIN) 474 if (errno == EAGAIN)
473 /* No worries */ 475 /* No worries */
474 return; 476 return;
475 477
476 tmp = g_strdup_printf(_("Lost connection with server\n%s"), 478 tmp = g_strdup_printf(_("Lost connection with server: %s"),
477 g_strerror(errno)); 479 g_strerror(errno));
478 ycht_connection_error(ycht, tmp); 480 ycht_connection_error(ycht, tmp);
479 g_free(tmp); 481 g_free(tmp);
480 return; 482 return;
481 } else if (len == 0) { 483 } else if (len == 0) {
482 ycht_connection_error(ycht, _("Server closed the connection.")); 484 ycht_connection_error(ycht, _("Server closed the connection"));
483 return; 485 return;
484 } 486 }
485 487
486 ycht->rxqueue = g_realloc(ycht->rxqueue, len + ycht->rxlen); 488 ycht->rxqueue = g_realloc(ycht->rxqueue, len + ycht->rxlen);
487 memcpy(ycht->rxqueue + ycht->rxlen, buf, len); 489 memcpy(ycht->rxqueue + ycht->rxlen, buf, len);
544 struct yahoo_data *yd = gc->proto_data; 546 struct yahoo_data *yd = gc->proto_data;
545 YchtPkt *pkt; 547 YchtPkt *pkt;
546 char *buf; 548 char *buf;
547 549
548 if (source < 0) { 550 if (source < 0) {
549 ycht_connection_error(ycht, _("Unable to connect.")); 551 ycht_connection_error(ycht, _("Unable to connect"));
550 return; 552 return;
551 } 553 }
552 554
553 ycht->fd = source; 555 ycht->fd = source;
554 556
580 if (purple_proxy_connect(gc, account, 582 if (purple_proxy_connect(gc, account,
581 purple_account_get_string(account, "ycht-server", YAHOO_YCHT_HOST), 583 purple_account_get_string(account, "ycht-server", YAHOO_YCHT_HOST),
582 purple_account_get_int(account, "ycht-port", YAHOO_YCHT_PORT), 584 purple_account_get_int(account, "ycht-port", YAHOO_YCHT_PORT),
583 ycht_got_connected, ycht) == NULL) 585 ycht_got_connected, ycht) == NULL)
584 { 586 {
585 ycht_connection_error(ycht, _("Connection problem")); 587 ycht_connection_error(ycht, _("Unable to connect"));
586 return; 588 return;
587 } 589 }
588 } 590 }
589 591
590 /******************************************************************************************* 592 /*******************************************************************************************