[evolution-data-server] Bug #512714 - Error string "Host lookup failed: Name or Service not known"



commit c71d89b394cd3b2886078c3bacfa8657a980b8f4
Author: Milan Crha <mcrha redhat com>
Date:   Mon Dec 3 18:16:21 2012 +0100

    Bug #512714 - Error string "Host lookup failed: Name or Service not known"

 camel/camel-net-utils.c |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/camel/camel-net-utils.c b/camel/camel-net-utils.c
index 2b1eed6..5165dc7 100644
--- a/camel/camel-net-utils.c
+++ b/camel/camel-net-utils.c
@@ -726,10 +726,14 @@ camel_getaddrinfo (const gchar *name,
 		cs_getaddrinfo, msg, _("Host lookup failed"),
 		cancellable, error) == 0) {
 
-		if (msg->result != 0) {
+		if (msg->result == EAI_NONAME || msg->result == EAI_FAIL) {
 			g_set_error (
 				error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
-				_("Host lookup failed: %s: %s"),
+				_("Host lookup '%s' failed. Check your host name for spelling errors."), name);
+		} else if (msg->result != 0) {
+			g_set_error (
+				error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+				_("Host lookup '%s' failed: %s"),
 				name, gai_strerror (msg->result));
 		}
 	} else
@@ -874,11 +878,16 @@ camel_getnameinfo (const struct sockaddr *sa,
 		cs_getnameinfo, msg, _("Name lookup failed"),
 		cancellable, error);
 
-	if ((result = msg->result) != 0)
+	result = msg->result;
+	if (result == EAI_NONAME || result == EAI_FAIL) {
+		g_set_error_literal (
+			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+			_("Name lookup failed. Check your host name for spelling errors."));
+	} else if (result) {
 		g_set_error (
 			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
 			_("Name lookup failed: %s"), gai_strerror (result));
-	else {
+	} else {
 		if (host)
 			*host = g_strdup(msg->host);
 		if (serv)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]