[evolution-data-server/gnome-2-28] Revert the previous patch as it breaks string freeze



commit d2ba89efbda415325841dd26db18296926ec52e0
Author: Chenthill Palanisamy <pchenthill novell com>
Date:   Mon Jan 18 12:38:35 2010 +0530

    Revert the previous patch as it breaks string freeze

 camel/providers/pop3/camel-pop3-store.c |   56 ++++++-------------------------
 1 files changed, 11 insertions(+), 45 deletions(-)
---
diff --git a/camel/providers/pop3/camel-pop3-store.c b/camel/providers/pop3/camel-pop3-store.c
index 3d9b684..89be794 100644
--- a/camel/providers/pop3/camel-pop3-store.c
+++ b/camel/providers/pop3/camel-pop3-store.c
@@ -60,9 +60,6 @@
 #define POP3_PORT "110"
 #define POP3S_PORT "995"
 
-/* defines the length of the server error message we can display in the error dialog */
-#define POP3_ERROR_SIZE_LIMIT 60
-
 static CamelStoreClass *parent_class = NULL;
 
 static void finalize (CamelObject *object);
@@ -150,25 +147,6 @@ enum {
 #define STARTTLS_FLAGS (CAMEL_TCP_STREAM_SSL_ENABLE_TLS)
 #endif
 
-/* returns error message with ': ' as prefix */
-static gchar *
-get_valid_utf8_error (const gchar *text)
-{
-	gchar *tmp = camel_utf8_make_valid (text);
-	gchar *ret = NULL;
-
-	/*TODO If the error message > size limit log it somewhere */
-	if (!tmp || g_utf8_strlen (tmp, -1) > POP3_ERROR_SIZE_LIMIT) {
-		g_free (tmp);
-		return NULL;
-	}
-
-	ret = g_strconcat (": ", tmp, NULL);
-
-	g_free (tmp);
-	return ret;
-}
-
 static gboolean
 connect_to_server (CamelService *service, struct addrinfo *ai, gint ssl_mode, CamelException *ex)
 {
@@ -256,13 +234,9 @@ connect_to_server (CamelService *service, struct addrinfo *ai, gint ssl_mode, Ca
 	camel_pop3_engine_command_free (store->engine, pc);
 
 	if (ret == FALSE) {
-		gchar *tmp = get_valid_utf8_error ((gchar *) store->engine->line);
-		
 		camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
-				_("Failed to connect to POP server %s in secure mode%s"),
-				service->url->host, tmp ? tmp:"");
-
-		g_free (tmp);
+			_("Failed to connect to POP server %s in secure mode: %s"),
+			service->url->host, store->engine->line);
 		goto stls_exception;
 	}
 
@@ -440,13 +414,9 @@ try_sasl(CamelPOP3Store *store, const gchar *mech, CamelException *ex)
 		if (strncmp((gchar *) line, "+OK", 3) == 0)
 			break;
 		if (strncmp((gchar *) line, "-ERR", 4) == 0) {
-			gchar *tmp = get_valid_utf8_error ((gchar *) store->engine->line);
-
 			camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
-					      _("SASL '%s' Login failed for POP server %s%s"),
-					      mech, CAMEL_SERVICE (store)->url->host, tmp ? tmp : "");
-
-			g_free (tmp);
+					      _("SASL '%s' Login failed for POP server %s: %s"),
+					      mech, CAMEL_SERVICE (store)->url->host, line);
 			goto done;
 		}
 		/* If we dont get continuation, or the sasl object's run out of work, or we dont get a challenge,
@@ -582,23 +552,17 @@ pop3_try_authenticate (CamelService *service, gboolean reprompt, const gchar *er
 					      errno ? g_strerror (errno) : _("Unknown error"));
 		}
 	} else if (pcu && pcu->state != CAMEL_POP3_COMMAND_OK) {
-		gchar *tmp = get_valid_utf8_error ((gchar *) store->engine->line);
-		
 		camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
 				      _("Unable to connect to POP server %s.\n"
-					"Error sending username%s"),
+					"Error sending username: %s"),
 				      CAMEL_SERVICE (store)->url->host,
-				      tmp ? tmp : "");
-		g_free (tmp);
+				      store->engine->line ? (gchar *)store->engine->line : _("Unknown error"));
 	} else if (pcp->state != CAMEL_POP3_COMMAND_OK) {
-		gchar *tmp = get_valid_utf8_error ((gchar *) store->engine->line);
-		
 		camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
 				      _("Unable to connect to POP server %s.\n"
-					"Error sending password%s"),
+					"Error sending password: %s"),
 				      CAMEL_SERVICE (store)->url->host,
-				      tmp ? tmp :"");
-		g_free (tmp);
+				      store->engine->line ? (gchar *)store->engine->line : _("Unknown error"));
 	}
 
 	camel_pop3_engine_command_free (store->engine, pcp);
@@ -645,7 +609,9 @@ pop3_connect (CamelService *service, CamelException *ex)
 
 		/* we only re-prompt if we failed to authenticate, any other error and we just abort */
 		if (status == 0 && camel_exception_get_id (ex) == CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE) {
-			errbuf = g_markup_printf_escaped ("%s\n\n", camel_exception_get_description (ex));
+			gchar *tmp = camel_utf8_make_valid (camel_exception_get_description (ex));
+			errbuf = g_markup_printf_escaped ("%s\n\n", tmp);
+			g_free (tmp);
 			camel_exception_clear (ex);
 
 			camel_session_forget_password (session, service, NULL, "password", ex);



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