[evolution-mapi] Do not set GError on E_SOURCE_AUTHENTICATION_REJECTED return value



commit cba9e5563a5ecbfa510143ba3cc05f914e14c802
Author: Milan Crha <mcrha redhat com>
Date:   Mon Jun 25 10:20:00 2012 +0200

    Do not set GError on E_SOURCE_AUTHENTICATION_REJECTED return value

 src/addressbook/e-book-backend-mapi.c          |    3 ++-
 src/calendar/e-cal-backend-mapi.c              |    7 ++++---
 src/collection/e-mapi-backend.c                |    5 ++++-
 src/configuration/e-mail-config-mapi-backend.c |    5 ++++-
 4 files changed, 14 insertions(+), 6 deletions(-)
---
diff --git a/src/addressbook/e-book-backend-mapi.c b/src/addressbook/e-book-backend-mapi.c
index 1142114..d61306f 100644
--- a/src/addressbook/e-book-backend-mapi.c
+++ b/src/addressbook/e-book-backend-mapi.c
@@ -405,7 +405,8 @@ ebbm_connect_user (EBookBackendMAPI *ebma,
 				priv->conn = NULL;
 			}
 
-			mapi_error_to_edb_error (error, mapi_error, E_DATA_BOOK_STATUS_OTHER_ERROR, _("Cannot connect"));
+			if (!is_network_error)
+				mapi_error_to_edb_error (error, mapi_error, E_DATA_BOOK_STATUS_OTHER_ERROR, _("Cannot connect"));
 			e_book_backend_mapi_unlock_connection (ebma);
 
 			if (mapi_error)
diff --git a/src/calendar/e-cal-backend-mapi.c b/src/calendar/e-cal-backend-mapi.c
index ec487fa..776a43e 100644
--- a/src/calendar/e-cal-backend-mapi.c
+++ b/src/calendar/e-cal-backend-mapi.c
@@ -1239,7 +1239,8 @@ ecbm_connect_user (ECalBackend *backend,
 	} else {
 		gboolean is_network_error = g_error_matches (mapi_error, E_MAPI_ERROR, MAPI_E_NETWORK_ERROR);
 
-		mapi_error_to_edc_error (perror, mapi_error, is_network_error ? OtherError : AuthenticationFailed, NULL);
+		if (!is_network_error)
+			mapi_error_to_edc_error (perror, mapi_error, is_network_error ? OtherError : AuthenticationFailed, NULL);
 		if (mapi_error)
 			g_error_free (mapi_error);
 		g_static_mutex_unlock (&auth_mutex);
@@ -1247,7 +1248,7 @@ ecbm_connect_user (ECalBackend *backend,
 	}
 
 	if (mapi_error) {
-		mapi_error_to_edc_error (perror, mapi_error, AuthenticationFailed, NULL);
+		/* do not set error when authentication was rejected */
 		g_error_free (mapi_error);
 		g_static_mutex_unlock (&auth_mutex);
 		return E_SOURCE_AUTHENTICATION_REJECTED;
@@ -1261,7 +1262,7 @@ ecbm_connect_user (ECalBackend *backend,
 	}
 
 	if (!priv->conn || !e_mapi_connection_connected (priv->conn)) {
-		g_propagate_error (perror, EDC_ERROR (AuthenticationFailed));
+		/* do not set error when authentication was rejected */
 		return E_SOURCE_AUTHENTICATION_REJECTED;
 	}
 
diff --git a/src/collection/e-mapi-backend.c b/src/collection/e-mapi-backend.c
index 82e8dd1..288df14 100644
--- a/src/collection/e-mapi-backend.c
+++ b/src/collection/e-mapi-backend.c
@@ -486,7 +486,10 @@ mapi_backend_try_password_sync (ESourceAuthenticator *authenticator,
 		    g_error_matches (mapi_error, E_MAPI_ERROR, MAPI_E_PASSWORD_EXPIRED))
 			res = E_SOURCE_AUTHENTICATION_REJECTED;
 
-		g_propagate_error (error, mapi_error);
+		if (res != E_SOURCE_AUTHENTICATION_REJECTED)
+			g_propagate_error (error, mapi_error);
+		else
+			g_clear_error (&mapi_error);
 
 		return res;
 	}
diff --git a/src/configuration/e-mail-config-mapi-backend.c b/src/configuration/e-mail-config-mapi-backend.c
index 4f40e8e..8954a50 100644
--- a/src/configuration/e-mail-config-mapi-backend.c
+++ b/src/configuration/e-mail-config-mapi-backend.c
@@ -325,7 +325,10 @@ mail_config_mapi_authenticator_try_password_sync (ESourceAuthenticator *auth,
 		g_warn_if_fail (!mapi_authenticator->success);
 		mapi_authenticator->success = FALSE;
 
-		g_propagate_error (error, mapi_error);
+		if (is_network_error)
+			g_propagate_error (error, mapi_error);
+		else
+			g_clear_error (&mapi_error);
 
 		return is_network_error ? E_SOURCE_AUTHENTICATION_ERROR : E_SOURCE_AUTHENTICATION_REJECTED;
 	}



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