Index: evolution-data-server/servers/exchange/lib/e2k-uri.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/exchange/lib/e2k-uri.c,v
retrieving revision 1.5
diff -u -p -r1.5 e2k-uri.c
--- evolution-data-server/servers/exchange/lib/e2k-uri.c	27 Jan 2006 14:16:06 -0000	1.5
+++ evolution-data-server/servers/exchange/lib/e2k-uri.c	17 Apr 2006 12:48:04 -0000
@@ -109,14 +109,6 @@ e2k_uri_new (const char *uri_string)
 				*backslash = '\0';
 				uri->user = g_strdup (backslash + 1);
 			}
-			else {
-				/* if backslash is not there check for @ */
-				user_at = strchr (uri->user, '@');
-				if (user_at) {
-					*user_at = '\0';
-					uri->domain = g_strdup (user_at + 1);
-				}
-			}
 		} else
 			uri->user = uri->passwd = uri->domain = NULL;
 
Index: evolution-data-server/servers/exchange/lib/e2k-validate.h
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/exchange/lib/e2k-validate.h,v
retrieving revision 1.3
diff -u -p -r1.3 e2k-validate.h
--- evolution-data-server/servers/exchange/lib/e2k-validate.h	1 Jul 2005 05:43:21 -0000	1.3
+++ evolution-data-server/servers/exchange/lib/e2k-validate.h	17 Apr 2006 12:48:59 -0000
@@ -36,7 +36,7 @@ typedef enum {
 	E2K_AUTOCONFIG_FAILED
 } E2kAutoconfigResult;
 
-gboolean e2k_validate_user (const char *owa_url, char *user, ExchangeParams *exchange_params, gboolean *remember_password, E2kAutoconfigResult *result);
+gboolean e2k_validate_user (const char *owa_url, char **user, ExchangeParams *exchange_params, gboolean *remember_password, E2kAutoconfigResult *result);
 
 
 #ifdef __cplusplus
Index: evolution-data-server/servers/exchange/lib/e2k-autoconfig.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/exchange/lib/e2k-autoconfig.c,v
retrieving revision 1.14
diff -u -p -r1.14 e2k-autoconfig.c
--- evolution-data-server/servers/exchange/lib/e2k-autoconfig.c	6 Mar 2006 06:00:25 -0000	1.14
+++ evolution-data-server/servers/exchange/lib/e2k-autoconfig.c	17 Apr 2006 12:50:01 -0000
@@ -1619,14 +1619,20 @@ validate (const char *owa_url, char *use
 }
 
 gboolean
-e2k_validate_user (const char *owa_url, char *user,
+e2k_validate_user (const char *owa_url, char **user,
 		   ExchangeParams *exchange_params, gboolean *remember_password,
 		   E2kAutoconfigResult *result)
 {
 	gboolean valid = FALSE, remember=FALSE;
 	char *key, *password, *prompt;
+	char *username;
+	gchar **usernames;
+	int try = 0;
 
-	key = g_strdup_printf ("%s//%s@%s/", "exchange:", user, owa_url); /* FIXME */
+try_auth_again:
+	username = g_strdup (*user);
+
+	key = g_strdup_printf ("%s//%s@%s/", "exchange:", username, owa_url); /* FIXME */
 	password = e_passwords_get_password ("Exchange", key);
 	if (password) {
 		/* This can be the case, where user presses authenticate button and
@@ -1636,7 +1642,7 @@ e2k_validate_user (const char *owa_url, 
 		e_passwords_forget_password ("Exchange", key);
 	}
 	
-	prompt = g_strdup_printf (_("Enter password for %s"), user);
+	prompt = g_strdup_printf (_("Enter password for %s"), username);
 	password = e_passwords_ask_password (_("Enter password"),
 				"Exchange", key, prompt,
 				E_PASSWORDS_REMEMBER_FOREVER|E_PASSWORDS_SECRET,
@@ -1644,10 +1650,11 @@ e2k_validate_user (const char *owa_url, 
 	g_free (prompt);
 	if (!password) {
 		g_free (key);
+		g_free (username);
 		return valid;
 	}
 
-	valid = validate (owa_url, user, password, exchange_params, result);
+	valid = validate (owa_url, username, password, exchange_params, result);
 	if (valid) {
 		/* generate the proper key once the host name 
 		 * is read and remember password temporarily, 
@@ -1659,18 +1666,35 @@ e2k_validate_user (const char *owa_url, 
 		g_free (key);
 		if (exchange_params->is_ntlm)
 			key = g_strdup_printf ("exchange://%s;auth=NTLM@%s/", 
-						       user, exchange_params->host);
+						       username, exchange_params->host);
 		else
-			key = g_strdup_printf ("exchange://%s@%s/", user, exchange_params->host);
+			key = g_strdup_printf ("exchange://%s@%s/", username, exchange_params->host);
 		e_passwords_add_password (key, password);
 		e_passwords_remember_password ("Exchange", key);
 	}
 	else {
+		if (try == 0) {
+			/* Check for name as e-mail id and try once again 
+			 * extracing username from e-mail id. 
+			 */
+			usernames = g_strsplit (*user, "@", 2);
+			if (usernames && usernames[0]) {
+				username = g_strdup (usernames[0]);
+				g_strfreev (usernames);
+				try ++;
+				memset(*user, 0, strlen(*user));
+				g_free (*user);
+				*user = g_strdup (username);
+				g_free (username);
+				goto try_auth_again;
+			}
+		}
 		/* if validation failed*/
 		e_passwords_forget_password ("Exchange", key);
 	}
 
 	g_free (key);
 	g_free (password);
+	g_free (username);
 	return valid;
 }
Index: evolution/plugins/exchange-operations/exchange-account-setup.c
===================================================================
RCS file: /cvs/gnome/evolution/plugins/exchange-operations/exchange-account-setup.c,v
retrieving revision 1.31
diff -u -p -r1.31 exchange-account-setup.c
--- evolution/plugins/exchange-operations/exchange-account-setup.c	20 Feb 2006 11:06:55 -0000	1.31
+++ evolution/plugins/exchange-operations/exchange-account-setup.c	17 Apr 2006 12:51:49 -0000
@@ -461,7 +461,7 @@ owa_authenticate_user(GtkWidget *button,
 		exchange_params->is_ntlm = TRUE;
 	else
 		exchange_params->is_ntlm = FALSE;
-	valid =  e2k_validate_user (owa_url, url->user, exchange_params, 
+	valid =  e2k_validate_user (owa_url, &url->user, exchange_params, 
 						&remember_password, &result);
 
 	if (!valid)
