[evolution-patches] Exchange connector : Minor fixes in exchange_account_connect()



Hi,

I was going through the code and found some unnecessary looping,
other small issues.

Please review the patch.

Thanks,
Sushma.
Index: evolution-data-server/servers/exchange/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/exchange/ChangeLog,v
retrieving revision 1.37
diff -u -p -r1.37 ChangeLog
--- evolution-data-server/servers/exchange/ChangeLog	26 Nov 2005 09:21:00 -0000	1.37
+++ evolution-data-server/servers/exchange/ChangeLog	29 Nov 2005 12:56:06 -0000
@@ -1,3 +1,10 @@
+2005-11-29  Sushma Rai  <rsushma novell com>
+
+	* storage/exchange-account.c (exchange_account_connect): set
+	account->priv->connecting flag to FALSE on NULL password.
+	Also removed unnecessary looping with try_password_again and also the
+	commented out code.
+
 2005-11-26  Sushma Rai  <rsushma novell com>
 
 	* storage/exchange-account.c (exchange_account_remove_folder)
Index: evolution-data-server/servers/exchange/storage/exchange-account.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/exchange/storage/exchange-account.c,v
retrieving revision 1.20
diff -u -p -r1.20 exchange-account.c
--- evolution-data-server/servers/exchange/storage/exchange-account.c	26 Nov 2005 09:21:01 -0000	1.20
+++ evolution-data-server/servers/exchange/storage/exchange-account.c	29 Nov 2005 12:56:33 -0000
@@ -1467,20 +1467,12 @@ exchange_account_connect (ExchangeAccoun
 				      account->priv->ad_limit);
 
 	if (!pword) {
+		account->priv->connecting = FALSE;
 		g_mutex_unlock (account->priv->connect_lock);
 		return NULL;
 	}
- try_password_again:
-	if (!pword) {
-/*
-		if (!get_password (account, ac, *info_result)) {
-			account->priv->connecting = FALSE;
-			return NULL;
-		}
-*/
-	} else {
-		e2k_autoconfig_set_password (ac, g_strdup (pword));
-	}
+
+	e2k_autoconfig_set_password (ac, g_strdup (pword));
 
  try_connect_again:
 	account->priv->ctx = e2k_autoconfig_get_context (ac, NULL, &result);
@@ -1497,38 +1489,11 @@ exchange_account_connect (ExchangeAccoun
 			account->priv->connecting = FALSE;
 			g_mutex_unlock (account->priv->connect_lock);
 			return NULL;
-/*
-			char *old_password, *new_password;
-			old_password = exchange_account_get_password (account);
-			//new_password = exchange_get_new_password (old_password, 0);
-
-			if (new_password) {
-				ExchangeAccountResult res;
-				res = exchange_account_set_password (account, old_password, new_password);
-				if (res == EXCHANGE_ACCOUNT_PASSWORD_CHANGE_SUCCESS) {
-					e2k_autoconfig_set_password (ac, new_password);
-					goto try_connect_again;
-				}
-				else
-					*info_result = res;
-				
-				g_free (old_password);
-				g_free (new_password);
-			}
-			else {
-				*info_result = EXCHANGE_ACCOUNT_PASSWORD_EXPIRED;
-				g_free (old_password);
-			}
-
-			result = E2K_AUTOCONFIG_CANCELLED;
-*/
 		}
 #endif
 		switch (result) {
 		case E2K_AUTOCONFIG_AUTH_ERROR:
 			*info_result = EXCHANGE_ACCOUNT_PASSWORD_INCORRECT;
-			if (!pword)
-				goto try_password_again;
 			e2k_autoconfig_free (ac);
 			account->priv->connecting = FALSE;
 			g_mutex_unlock (account->priv->connect_lock);
@@ -1536,8 +1501,6 @@ exchange_account_connect (ExchangeAccoun
 
 		case E2K_AUTOCONFIG_AUTH_ERROR_TRY_DOMAIN:
 			*info_result = EXCHANGE_ACCOUNT_DOMAIN_ERROR;
-			if (!pword)
-				goto try_password_again;
 			e2k_autoconfig_free (ac);
 			account->priv->connecting = FALSE;
 			g_mutex_unlock (account->priv->connect_lock);
@@ -1567,9 +1530,6 @@ exchange_account_connect (ExchangeAccoun
 
 		e2k_autoconfig_free (ac);
 		account->priv->connecting = FALSE;
-
-		// SURF : if (!exchange_component_is_interactive (global_exchange_component))
-			// SURF : return NULL;
 
 		switch (result) {
 		case E2K_AUTOCONFIG_REDIRECT:
Index: evolution-exchange/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-exchange/ChangeLog,v
retrieving revision 1.416
diff -u -p -r1.416 ChangeLog
--- evolution-exchange/ChangeLog	28 Nov 2005 11:36:48 -0000	1.416
+++ evolution-exchange/ChangeLog	29 Nov 2005 12:57:25 -0000
@@ -1,3 +1,8 @@
+2005-11-29  Sushma Rai  <rsushma novell com>
+
+	* calendar/e-cal-backend-exchange.c (open_calendar): Return 
+	authentication failure error code if exchange_account_connect() fails.
+
 2005-11-28  Sarfraaz Ahmed  <asarfraaz novell com>
 
 	* calendar/e-cal-backend-exchange-calendar.c (modify_object_with_href):
Index: evolution-exchange/calendar/e-cal-backend-exchange.c
===================================================================
RCS file: /cvs/gnome/evolution-exchange/calendar/e-cal-backend-exchange.c,v
retrieving revision 1.46
diff -u -p -r1.46 e-cal-backend-exchange.c
--- evolution-exchange/calendar/e-cal-backend-exchange.c	28 Nov 2005 11:36:48 -0000	1.46
+++ evolution-exchange/calendar/e-cal-backend-exchange.c	29 Nov 2005 12:57:51 -0000
@@ -327,8 +327,12 @@ open_calendar (ECalBackendSync *backend,
 	/* Make sure we have an open connection */
 	/* This steals the ExchangeAccount from ExchangeComponent */
 	act = exchange_component_get_account_for_uri (global_exchange_component, NULL);
-	if (!exchange_account_get_context (act))
-		exchange_account_connect (act, password, &acresult);
+	if (!exchange_account_get_context (act)) {
+		if (!exchange_account_connect (act, password, &acresult)) {
+			g_mutex_unlock (cbex->priv->open_lock);
+			return GNOME_Evolution_Calendar_AuthenticationFailed;
+		}
+	}
 
 	cbex->account = exchange_component_get_account_for_uri (global_exchange_component, uristr);
 	if (!cbex->account) {


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