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	12 Apr 2006 07:52:05 -0000
@@ -1625,8 +1625,19 @@ e2k_validate_user (const char *owa_url, 
 {
 	gboolean valid = FALSE, remember=FALSE;
 	char *key, *password, *prompt;
+	char *username;
+	gchar **usernames;
 
-	key = g_strdup_printf ("%s//%s@%s/", "exchange:", user, owa_url); /* FIXME */
+	usernames = g_strsplit (user, "@", 2);
+	if (usernames && usernames[0]) {
+		username = g_strdup (usernames[0]);
+		g_strfreev (usernames);
+	}
+	else {
+		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 +1647,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 +1655,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,9 +1671,9 @@ 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);
 	}
@@ -1672,5 +1684,6 @@ e2k_validate_user (const char *owa_url, 
 
 	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	12 Apr 2006 09:20:38 -0000
@@ -469,6 +469,17 @@ owa_authenticate_user(GtkWidget *button,
 	camel_url_set_host (url, valid ? exchange_params->host : "");
 
 	if (valid) {
+		gchar **usernames;
+		/* FIXME: instead of doing this twice here and e2k_validate_user
+		 * we need to do it once
+                 */
+		usernames = g_strsplit (url->user, "@", 2);
+		if (usernames && usernames[0]) {
+			memset(url->user, 0, strlen(url->user));
+			g_free (url->user);
+			url->user = g_strdup (usernames[0]);
+			g_strfreev (usernames);
+        	}
 		camel_url_set_authmech (url, exchange_params->is_ntlm ? "NTLM" : "Basic");
 		camel_url_set_param (url, "save-passwd", remember_password? "true" : "false");
 	}
@@ -926,7 +937,7 @@ org_gnome_exchange_show_folder_size_fact
 	GtkListStore *model;
 	GtkVBox *vbx;
 	GtkHBox *hbx_size;
-	char *folder_name, *folder_size;
+	char *folder_name, *folder_size; 
 
 	service = CAMEL_SERVICE (camel_folder_get_parent_store (cml_folder));
 	if (!service)
