changeset 14426:b6047532826b

[gaim-migrate @ 17136] Better connection error messages for Yahoo committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sun, 03 Sep 2006 07:40:11 +0000
parents 3a91ef295cbb
children 1e00e8245720
files libgaim/protocols/yahoo/yahoo.c libgaim/protocols/yahoo/ycht.c
diffstat 2 files changed, 42 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/libgaim/protocols/yahoo/yahoo.c	Sun Sep 03 02:12:26 2006 +0000
+++ b/libgaim/protocols/yahoo/yahoo.c	Sun Sep 03 07:40:11 2006 +0000
@@ -2233,8 +2233,20 @@
 
 	len = read(yd->fd, buf, sizeof(buf));
 
-	if (len <= 0) {
-		gaim_connection_error(gc, _("Unable to read"));
+	if (len < 0) {
+		gchar *tmp;
+
+		if (errno == EAGAIN)
+			/* No worries */
+			return;
+
+		tmp = g_strdup_printf(_("Lost connection with server:\n%s"),
+				strerror(errno));
+		gaim_connection_error(gc, tmp);
+		g_free(tmp);
+		return;
+	} else if (len == 0) {
+		gaim_connection_error(gc, _("Server closed the connection."));
 		return;
 	}
 
@@ -2378,10 +2390,21 @@
 	GString *s;
 
 	len = read(source, bufread, sizeof(bufread) - 1);
-	if (len < 0 && errno == EAGAIN)
+
+	if (len < 0) {
+		gchar *tmp;
+
+		if (errno == EAGAIN)
+			/* No worries */
+			return;
+
+		tmp = g_strdup_printf(_("Lost connection with server:\n%s"),
+				strerror(errno));
+		gaim_connection_error(gc, tmp);
+		g_free(tmp);
 		return;
-	else if (len <= 0) {
-		gaim_connection_error(gc, _("Unable to read"));
+	} else if (len == 0) {
+		gaim_connection_error(gc, _("Server closed the connection."));
 		return;
 	}
 
@@ -2396,7 +2419,7 @@
 
 	if ((strncmp(buf, "HTTP/1.0 302", strlen("HTTP/1.0 302")) &&
 			  strncmp(buf, "HTTP/1.1 302", strlen("HTTP/1.1 302")))) {
-		gaim_connection_error(gc, _("Unable to read"));
+		gaim_connection_error(gc, _("Received unexpected HTTP response from server."));
 		return;
 	}
 
--- a/libgaim/protocols/yahoo/ycht.c	Sun Sep 03 02:12:26 2006 +0000
+++ b/libgaim/protocols/yahoo/ycht.c	Sun Sep 03 07:40:11 2006 +0000
@@ -465,11 +465,20 @@
 
 	len = read(ycht->fd, buf, sizeof(buf));
 
-	if (len < 0 && errno == EAGAIN)
-		return;
+	if (len < 0) {
+		gchar *tmp;
+
+		if (errno == EAGAIN)
+			/* No worries */
+			return;
 
-	if (len <= 0) {
-		ycht_connection_error(ycht, _("Unable to read"));
+		tmp = g_strdup_printf(_("Lost connection with server\n%s"),
+				strerror(errno));
+		ycht_connection_error(ycht, tmp);
+		g_free(tmp);
+		return;
+	} else if (len == 0) {
+		ycht_connection_error(ycht, _("Server closed the connection."));
 		return;
 	}