comparison libpurple/protocols/irc/irc.c @ 27455:2873ee6a960d

Similar connection error message changes for IRC. These are hopefully more understandable for plain humans, and I think some of them also overlap with existing strings in oscar.
author Mark Doliner <mark@kingant.net>
date Mon, 06 Jul 2009 05:28:59 +0000
parents da9d25c582c1
children f541583e31bd
comparison
equal deleted inserted replaced
27454:7fd1b4c73310 27455:2873ee6a960d
120 120
121 if (ret < 0 && errno == EAGAIN) 121 if (ret < 0 && errno == EAGAIN)
122 return; 122 return;
123 else if (ret <= 0) { 123 else if (ret <= 0) {
124 PurpleConnection *gc = purple_account_get_connection(irc->account); 124 PurpleConnection *gc = purple_account_get_connection(irc->account);
125 gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"),
126 g_strerror(errno));
125 purple_connection_error_reason (gc, 127 purple_connection_error_reason (gc,
126 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, 128 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp);
127 _("Server has disconnected")); 129 g_free(tmp);
128 return; 130 return;
129 } 131 }
130 132
131 purple_circ_buffer_mark_read(irc->outbuf, ret); 133 purple_circ_buffer_mark_read(irc->outbuf, ret);
132 134
160 162
161 /* purple_debug(PURPLE_DEBUG_MISC, "irc", "sent%s: %s", 163 /* purple_debug(PURPLE_DEBUG_MISC, "irc", "sent%s: %s",
162 irc->gsc ? " (ssl)" : "", tosend); */ 164 irc->gsc ? " (ssl)" : "", tosend); */
163 if (ret <= 0 && errno != EAGAIN) { 165 if (ret <= 0 && errno != EAGAIN) {
164 PurpleConnection *gc = purple_account_get_connection(irc->account); 166 PurpleConnection *gc = purple_account_get_connection(irc->account);
167 gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"),
168 g_strerror(errno));
165 purple_connection_error_reason (gc, 169 purple_connection_error_reason (gc,
166 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, 170 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp);
167 _("Server has disconnected")); 171 g_free(tmp);
168 } else if (ret < buflen) { 172 } else if (ret < buflen) {
169 if (ret < 0) 173 if (ret < 0)
170 ret = 0; 174 ret = 0;
171 if (!irc->writeh) 175 if (!irc->writeh)
172 irc->writeh = purple_input_add( 176 irc->writeh = purple_input_add(
348 purple_account_get_int(account, "port", IRC_DEFAULT_PORT), 352 purple_account_get_int(account, "port", IRC_DEFAULT_PORT),
349 irc_login_cb, gc) == NULL) 353 irc_login_cb, gc) == NULL)
350 { 354 {
351 purple_connection_error_reason (gc, 355 purple_connection_error_reason (gc,
352 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, 356 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
353 _("Couldn't create socket")); 357 _("Unable to create socket"));
354 return; 358 return;
355 } 359 }
356 } 360 }
357 } 361 }
358 362
444 { 448 {
445 PurpleConnection *gc = data; 449 PurpleConnection *gc = data;
446 struct irc_conn *irc = gc->proto_data; 450 struct irc_conn *irc = gc->proto_data;
447 451
448 if (source < 0) { 452 if (source < 0) {
453 gchar *tmp = g_strdup_printf(_("Unable to connect: %s"),
454 error_message);
449 purple_connection_error_reason (gc, 455 purple_connection_error_reason (gc,
450 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, 456 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp);
451 _("Couldn't connect to host")); 457 g_free(tmp);
452 return; 458 return;
453 } 459 }
454 460
455 irc->fd = source; 461 irc->fd = source;
456 462
633 639
634 if (len < 0 && errno == EAGAIN) { 640 if (len < 0 && errno == EAGAIN) {
635 /* Try again later */ 641 /* Try again later */
636 return; 642 return;
637 } else if (len < 0) { 643 } else if (len < 0) {
644 gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"),
645 g_strerror(errno));
638 purple_connection_error_reason (gc, 646 purple_connection_error_reason (gc,
639 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, 647 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp);
640 _("Read error")); 648 g_free(tmp);
641 return; 649 return;
642 } else if (len == 0) { 650 } else if (len == 0) {
643 purple_connection_error_reason (gc, 651 purple_connection_error_reason (gc,
644 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, 652 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
645 _("Server has disconnected")); 653 _("Server closed the connection"));
646 return; 654 return;
647 } 655 }
648 656
649 read_input(irc, len); 657 read_input(irc, len);
650 } 658 }
662 670
663 len = read(irc->fd, irc->inbuf + irc->inbufused, IRC_INITIAL_BUFSIZE - 1); 671 len = read(irc->fd, irc->inbuf + irc->inbufused, IRC_INITIAL_BUFSIZE - 1);
664 if (len < 0 && errno == EAGAIN) { 672 if (len < 0 && errno == EAGAIN) {
665 return; 673 return;
666 } else if (len < 0) { 674 } else if (len < 0) {
675 gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"),
676 g_strerror(errno));
667 purple_connection_error_reason (gc, 677 purple_connection_error_reason (gc,
668 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, 678 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp);
669 _("Read error")); 679 g_free(tmp);
670 return; 680 return;
671 } else if (len == 0) { 681 } else if (len == 0) {
672 purple_connection_error_reason (gc, 682 purple_connection_error_reason (gc,
673 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, 683 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
674 _("Server has disconnected")); 684 _("Server closed the connection"));
675 return; 685 return;
676 } 686 }
677 687
678 read_input(irc, len); 688 read_input(irc, len);
679 } 689 }