[evolution-ews] EEwsSettings: Add a CamelEwsSettings property.



commit 9ed6c666c292a55cb6ef68f729d92e86eec0e0f0
Author: Matthew Barnes <mbarnes redhat com>
Date:   Mon Jul 30 12:34:31 2012 -0400

    EEwsSettings: Add a CamelEwsSettings property.

 src/addressbook/e-book-backend-ews.c               |   56 ++----
 src/calendar/e-cal-backend-ews.c                   |   12 +-
 src/camel/camel-ews-store.c                        |   39 +----
 src/collection/e-ews-backend.c                     |   22 +--
 src/configuration/e-ews-config-utils.c             |    4 +-
 .../e-mail-config-ews-oal-combo-box.c              |   11 +-
 src/configuration/e-mail-config-ews-ooo-page.c     |   13 +-
 src/server/e-ews-connection.c                      |  198 ++++++++++++++------
 src/server/e-ews-connection.h                      |    9 +-
 src/server/tests/test-autocompletion.c             |   11 +-
 src/server/tests/test-connection.c                 |   10 +-
 src/server/tests/test-createfolder.c               |   11 +-
 src/server/tests/test-cuditem.c                    |   10 +-
 src/server/tests/test-deletefolder.c               |   11 +-
 src/server/tests/test-get-oof-settings.c           |   10 +-
 src/server/tests/test-getattachment.c              |   11 +-
 src/server/tests/test-getdelegate.c                |   11 +-
 src/server/tests/test-set-oof-settings.c           |   10 +-
 src/server/tests/test-syncfolder.c                 |   30 +++-
 src/utils/ews-test-finditem-query.c                |   10 +-
 20 files changed, 301 insertions(+), 198 deletions(-)
---
diff --git a/src/addressbook/e-book-backend-ews.c b/src/addressbook/e-book-backend-ews.c
index 86b3977..44b919c 100644
--- a/src/addressbook/e-book-backend-ews.c
+++ b/src/addressbook/e-book-backend-ews.c
@@ -70,7 +70,6 @@ struct _EBookBackendEwsPrivate {
 	gchar *oab_url;
 	gchar *folder_name;
 
-	gchar *username;
 	gchar *password;
 
 	EwsBookBackendSqliteDB *ebsdb;
@@ -1682,9 +1681,9 @@ ews_download_full_gal (EBookBackendEws *cbews,
 	gchar *full_url, *oab_url, *cache_file = NULL;
 	const gchar *cache_dir;
 	gchar *comp_cache_file = NULL, *uncompress_file = NULL;
-	CamelEwsSettings *settings;
+	CamelEwsSettings *ews_settings;
 
-	settings = book_backend_ews_get_collection_settings (cbews);
+	ews_settings = book_backend_ews_get_collection_settings (cbews);
 
 	/* oab url with oab.xml removed from the suffix */
 	oab_url = g_strndup (priv->oab_url, strlen (priv->oab_url) - 7);
@@ -1692,10 +1691,8 @@ ews_download_full_gal (EBookBackendEws *cbews,
 	cache_dir = e_book_backend_get_cache_dir (E_BOOK_BACKEND (cbews));
 	comp_cache_file = g_build_filename (cache_dir, full->filename, NULL);
 
-	oab_cnc = e_ews_connection_new (full_url, priv->username, priv->password,
-		camel_network_settings_get_auth_mechanism (CAMEL_NETWORK_SETTINGS (settings)),
-		camel_ews_settings_get_timeout (settings),
-		NULL, NULL, NULL);
+	oab_cnc = e_ews_connection_new (
+		full_url, priv->password, ews_settings, NULL, NULL, NULL);
 	if (!e_ews_connection_download_oal_file_sync (
 		oab_cnc, comp_cache_file, NULL, NULL, cancellable, error))
 		goto exit;
@@ -1843,16 +1840,15 @@ ebews_start_gal_sync (gpointer data)
 	GSList *full_l = NULL;
 	gboolean ret = TRUE;
 	gchar *uncompressed_filename = NULL;
-	CamelEwsSettings *settings;
+	CamelEwsSettings *ews_settings;
 
 	cbews = (EBookBackendEws *) data;
-	settings = book_backend_ews_get_collection_settings (cbews);
+	ews_settings = book_backend_ews_get_collection_settings (cbews);
 	priv = cbews->priv;
 
-	oab_cnc = e_ews_connection_new (priv->oab_url, priv->username, priv->password,
-		camel_network_settings_get_auth_mechanism (CAMEL_NETWORK_SETTINGS (settings)),
-		camel_ews_settings_get_timeout (settings),
-		NULL, NULL, NULL);
+	oab_cnc = e_ews_connection_new (
+		priv->oab_url, priv->password,
+		ews_settings, NULL, NULL, NULL);
 
 	d(printf ("Ewsgal: Fetching oal full details file \n");)
 
@@ -2882,11 +2878,6 @@ e_book_backend_ews_dispose (GObject *object)
 		priv->folder_name = NULL;
 	}
 
-	if (priv->username) {
-		g_free (priv->username);
-		priv->username = NULL;
-	}
-
 	if (priv->password) {
 		g_free (priv->password);
 		priv->password = NULL;
@@ -2936,12 +2927,10 @@ book_backend_ews_try_password_sync (ESourceAuthenticator *authenticator,
 	EEwsConnection *connection;
 	ESourceAuthenticationResult result;
 	CamelEwsSettings *ews_settings;
-	CamelNetworkSettings *network_settings;
 	EwsFolderId *fid = NULL;
 	GSList *folders = NULL;
 	GSList *ids = NULL;
 	gchar *hosturl;
-	gchar *user;
 	GError *local_error = NULL;
 
 	/* This tests the password by fetching the contacts folder. */
@@ -2950,19 +2939,14 @@ book_backend_ews_try_password_sync (ESourceAuthenticator *authenticator,
 	ews_settings = book_backend_ews_get_collection_settings (backend);
 	hosturl = camel_ews_settings_dup_hosturl (ews_settings);
 
-	network_settings = CAMEL_NETWORK_SETTINGS (ews_settings);
-	user = camel_network_settings_dup_user (network_settings);
-
 	connection = e_ews_connection_new (
-		hosturl, user, password->str,
-		camel_network_settings_get_auth_mechanism (network_settings),
-		camel_ews_settings_get_timeout (ews_settings),
-		NULL, NULL, error);
+		hosturl, password->str,
+		ews_settings, NULL, NULL, error);
 
-	if (connection == NULL) {
-		result = E_SOURCE_AUTHENTICATION_ERROR;
-		goto exit;
-	}
+	g_free (hosturl);
+
+	if (connection == NULL)
+		return E_SOURCE_AUTHENTICATION_ERROR;
 
 	fid = g_new0 (EwsFolderId, 1);
 	fid->id = g_strdup ("contacts");
@@ -2985,11 +2969,9 @@ book_backend_ews_try_password_sync (ESourceAuthenticator *authenticator,
 			g_object_unref (backend->priv->cnc);
 		backend->priv->cnc = g_object_ref (connection);
 
-		/* Stash the username and password for later
-		 * reuse in Offline Address Book connections. */
-		g_free (backend->priv->username);
+		/* Stash the password for later reuse
+		 * in Offline Address Book connections. */
 		g_free (backend->priv->password);
-		backend->priv->username = g_strdup (user);
 		backend->priv->password = g_strdup (password->str);
 
 		PRIV_UNLOCK (backend->priv);
@@ -3014,10 +2996,6 @@ book_backend_ews_try_password_sync (ESourceAuthenticator *authenticator,
 
 	g_object_unref (connection);
 
-exit:
-	g_free (hosturl);
-	g_free (user);
-
 	return result;
 }
 
diff --git a/src/calendar/e-cal-backend-ews.c b/src/calendar/e-cal-backend-ews.c
index 29351a8..2f276f1 100644
--- a/src/calendar/e-cal-backend-ews.c
+++ b/src/calendar/e-cal-backend-ews.c
@@ -4055,7 +4055,6 @@ cal_backend_ews_try_password_sync (ESourceAuthenticator *authenticator,
 	EEwsConnection *connection;
 	ESourceAuthenticationResult result;
 	CamelEwsSettings *ews_settings;
-	CamelNetworkSettings *network_settings;
 	GSList *items_created = NULL;
 	GSList *items_updated = NULL;
 	GSList *items_deleted = NULL;
@@ -4063,7 +4062,6 @@ cal_backend_ews_try_password_sync (ESourceAuthenticator *authenticator,
 	const gchar *sync_state;
 	gchar *sync_state_inout;
 	gchar *hosturl;
-	gchar *user;
 	GError *local_error = NULL;
 
 	/* This tests the password by synchronizing the folder. */
@@ -4072,17 +4070,11 @@ cal_backend_ews_try_password_sync (ESourceAuthenticator *authenticator,
 	ews_settings = cal_backend_ews_get_collection_settings (backend);
 	hosturl = camel_ews_settings_dup_hosturl (ews_settings);
 
-	network_settings = CAMEL_NETWORK_SETTINGS (ews_settings);
-	user = camel_network_settings_dup_user (network_settings);
-
 	connection = e_ews_connection_new (
-		hosturl, user, password->str,
-		camel_network_settings_get_auth_mechanism (network_settings),
-		camel_ews_settings_get_timeout (ews_settings),
-		NULL, NULL, error);
+		hosturl, password->str,
+		ews_settings, NULL, NULL, error);
 
 	g_free (hosturl);
-	g_free (user);
 
 	if (connection == NULL)
 		return E_SOURCE_AUTHENTICATION_ERROR;
diff --git a/src/camel/camel-ews-store.c b/src/camel/camel-ews-store.c
index 19c76d3..daea273 100644
--- a/src/camel/camel-ews-store.c
+++ b/src/camel/camel-ews-store.c
@@ -214,40 +214,19 @@ ews_update_folder_hierarchy (CamelEwsStore *ews_store,
 }
 
 static void
-ews_store_update_cnc_timeout_cb (CamelEwsSettings *settings,
-				 GParamSpec *spec,
-				 CamelEwsStore *store)
-{
-	g_return_if_fail (CAMEL_IS_EWS_SETTINGS (settings));
-	g_return_if_fail (CAMEL_IS_EWS_STORE (store));
-
-	if (store->priv->cnc)
-		e_ews_connection_set_timeout (store->priv->cnc,
-			camel_ews_settings_get_timeout (settings));
-}
-
-static void
 ews_store_authenticate (EEwsConnection *cnc,
                         SoupMessage *msg,
                         SoupAuth *auth,
                         gboolean retrying,
                         gpointer data)
 {
-	CamelNetworkSettings *network_settings;
-	CamelSettings *settings;
 	CamelService *service = data;
 	const gchar *password;
-	const gchar *user;
 
 	password = camel_service_get_password (service);
-	settings = camel_service_get_settings (service);
-
-	network_settings = CAMEL_NETWORK_SETTINGS (settings);
-	user = camel_network_settings_get_user (network_settings);
-
 	g_return_if_fail (password != NULL);
 
-	e_ews_connection_authenticate (cnc, auth, user, password, NULL);
+	e_ews_connection_authenticate (cnc, auth, password, NULL);
 }
 
 static gboolean
@@ -258,11 +237,9 @@ ews_connect_sync (CamelService *service,
 	CamelEwsStore *ews_store;
 	CamelEwsStorePrivate *priv;
 	CamelEwsSettings *ews_settings;
-	CamelNetworkSettings *network_settings;
 	CamelSettings *settings;
 	CamelSession *session;
 	const gchar *hosturl;
-	const gchar *user;
 	gboolean success;
 
 	ews_store = (CamelEwsStore *) service;
@@ -270,9 +247,6 @@ ews_connect_sync (CamelService *service,
 	session = camel_service_get_session (service);
 	settings = camel_service_get_settings (service);
 
-	network_settings = CAMEL_NETWORK_SETTINGS (settings);
-	user = camel_network_settings_get_user (network_settings);
-
 	ews_settings = CAMEL_EWS_SETTINGS (settings);
 	hosturl = camel_ews_settings_get_hosturl (ews_settings);
 
@@ -282,11 +256,10 @@ ews_connect_sync (CamelService *service,
 	if (priv->cnc)
 		return TRUE;
 
-	priv->cnc = e_ews_connection_new (hosturl, user, NULL,
-					  camel_network_settings_get_auth_mechanism (network_settings),
-					  camel_ews_settings_get_timeout (ews_settings),
-					  G_CALLBACK (ews_store_authenticate), service,
-					  error);
+	priv->cnc = e_ews_connection_new (
+		hosturl, NULL, ews_settings,
+		G_CALLBACK (ews_store_authenticate), service,
+		error);
 
 	if (!priv->cnc) {
 		return FALSE;
@@ -303,8 +276,6 @@ ews_connect_sync (CamelService *service,
 		return FALSE;
 	}
 
-	g_signal_connect (ews_settings, "notify::timeout", G_CALLBACK (ews_store_update_cnc_timeout_cb), service);
-
 	camel_offline_store_set_online_sync (
 		CAMEL_OFFLINE_STORE (ews_store), TRUE, cancellable, NULL);
 
diff --git a/src/collection/e-ews-backend.c b/src/collection/e-ews-backend.c
index 2ce4dbc..17935e9 100644
--- a/src/collection/e-ews-backend.c
+++ b/src/collection/e-ews-backend.c
@@ -588,46 +588,28 @@ ews_backend_try_password_sync (ESourceAuthenticator *authenticator,
 {
 	EEwsBackend *backend;
 	EEwsConnection *connection;
-	ESource *source;
-	ESourceCollection *collection_extension;
 	ESourceAuthenticationResult result;
 	CamelEwsSettings *ews_settings;
-	CamelNetworkSettings *network_settings;
 	GSList *folders_created = NULL;
 	GSList *folders_updated = NULL;
 	GSList *folders_deleted = NULL;
 	gboolean includes_last_folder = FALSE;
-	const gchar *extension_name;
-	gchar *auth_mech;
 	gchar *sync_state;
 	gchar *hosturl;
-	gchar *user;
-	guint timeout;
 	GError *local_error = NULL;
 
 	/* This tests the password by updating the folder hierarchy. */
 
 	backend = E_EWS_BACKEND (authenticator);
-	source = e_backend_get_source (E_BACKEND (backend));
 
 	ews_settings = ews_backend_get_settings (backend);
 	hosturl = camel_ews_settings_dup_hosturl (ews_settings);
-	timeout = camel_ews_settings_get_timeout (ews_settings);
-
-	network_settings = CAMEL_NETWORK_SETTINGS (ews_settings);
-	auth_mech = camel_network_settings_dup_auth_mechanism (network_settings);
-
-	extension_name = E_SOURCE_EXTENSION_COLLECTION;
-	collection_extension = e_source_get_extension (source, extension_name);
-	user = e_source_collection_dup_identity (collection_extension);
 
 	connection = e_ews_connection_new (
-		hosturl, user, password->str,
-		auth_mech, timeout, NULL, NULL, error);
+		hosturl, password->str,
+		ews_settings, NULL, NULL, error);
 
-	g_free (auth_mech);
 	g_free (hosturl);
-	g_free (user);
 
 	if (connection == NULL)
 		return E_SOURCE_AUTHENTICATION_ERROR;
diff --git a/src/configuration/e-ews-config-utils.c b/src/configuration/e-ews-config-utils.c
index 2021586..0c7a2b1 100644
--- a/src/configuration/e-ews-config-utils.c
+++ b/src/configuration/e-ews-config-utils.c
@@ -275,9 +275,7 @@ ews_config_utils_authenticator_try_password_sync (ESourceAuthenticator *auth,
 	user = camel_network_settings_dup_user (network_settings);
 
 	authenticator->conn = e_ews_connection_new (
-		hosturl, user, password->str,
-		camel_network_settings_get_auth_mechanism (network_settings),
-		camel_ews_settings_get_timeout (authenticator->ews_settings),
+		hosturl, password->str, authenticator->ews_settings,
 		NULL, NULL, &local_error);
 
 	g_free (hosturl);
diff --git a/src/configuration/e-mail-config-ews-oal-combo-box.c b/src/configuration/e-mail-config-ews-oal-combo-box.c
index 0c33f6b..7e1030a 100644
--- a/src/configuration/e-mail-config-ews-oal-combo-box.c
+++ b/src/configuration/e-mail-config-ews-oal-combo-box.c
@@ -141,12 +141,10 @@ mail_config_ews_oal_combo_box_try_password_sync (ESourceAuthenticator *auth,
 	EMailConfigServiceBackend *backend;
 	CamelSettings *settings;
 	CamelEwsSettings *ews_settings;
-	CamelNetworkSettings *network_settings;
 	ESourceAuthenticationResult result;
 	EEwsConnection *cnc;
 	GSList *oal_items = NULL;
 	const gchar *oab_url;
-	const gchar *user;
 	GError *local_error = NULL;
 
 	combo_box = E_MAIL_CONFIG_EWS_OAL_COMBO_BOX (auth);
@@ -156,15 +154,10 @@ mail_config_ews_oal_combo_box_try_password_sync (ESourceAuthenticator *auth,
 	ews_settings = CAMEL_EWS_SETTINGS (settings);
 	oab_url = camel_ews_settings_get_oaburl (ews_settings);
 
-	network_settings = CAMEL_NETWORK_SETTINGS (settings);
-	user = camel_network_settings_get_user (network_settings);
-
 	/* XXX This takes a GError but never fails, so skip it. */
 	cnc = e_ews_connection_new (
-		oab_url, user, password->str,
-		camel_network_settings_get_auth_mechanism (network_settings),
-		camel_ews_settings_get_timeout (ews_settings),
-		NULL, NULL, NULL);
+		oab_url, password->str,
+		ews_settings, NULL, NULL, NULL);
 
 	e_ews_connection_get_oal_list_sync (
 		cnc, &oal_items, cancellable, &local_error);
diff --git a/src/configuration/e-mail-config-ews-ooo-page.c b/src/configuration/e-mail-config-ews-ooo-page.c
index 94c82ba..32a0f6a 100644
--- a/src/configuration/e-mail-config-ews-ooo-page.c
+++ b/src/configuration/e-mail-config-ews-ooo-page.c
@@ -782,15 +782,11 @@ mail_config_ews_ooo_page_try_password_sync (ESourceAuthenticator *auth,
 	EMailConfigEwsOooPage *page;
 	CamelSettings *settings;
 	CamelEwsSettings *ews_settings;
-	CamelNetworkSettings *network_settings;
 	ESourceAuthenticationResult result;
 	EEwsConnection *connection;
 	EEwsOofSettings *oof_settings;
 	const gchar *hosturl;
 	const gchar *mailbox;
-	const gchar *mech;
-	const gchar *user;
-	guint timeout;
 	GError *local_error = NULL;
 
 	page = E_MAIL_CONFIG_EWS_OOO_PAGE (auth);
@@ -799,16 +795,11 @@ mail_config_ews_ooo_page_try_password_sync (ESourceAuthenticator *auth,
 
 	ews_settings = CAMEL_EWS_SETTINGS (settings);
 	hosturl = camel_ews_settings_get_hosturl (ews_settings);
-	timeout = camel_ews_settings_get_timeout (ews_settings);
-
-	network_settings = CAMEL_NETWORK_SETTINGS (settings);
-	user = camel_network_settings_get_user (network_settings);
-	mech = camel_network_settings_get_auth_mechanism (network_settings);
 
 	/* XXX This takes a GError but never fails, so skip it. */
 	connection = e_ews_connection_new (
-		hosturl, user, password->str,
-		mech, timeout, NULL, NULL, NULL);
+		hosturl, password->str,
+		ews_settings, NULL, NULL, NULL);
 
 	e_ews_connection_set_mailbox (connection, mailbox);
 
diff --git a/src/server/e-ews-connection.c b/src/server/e-ews-connection.c
index 4f8e0ce..a29a1d1 100644
--- a/src/server/e-ews-connection.c
+++ b/src/server/e-ews-connection.c
@@ -76,13 +76,13 @@ struct _EEwsConnectionPrivate {
 	GMainLoop *soup_loop;
 	GMainContext *soup_context;
 
+	CamelEwsSettings *settings;
 	GMutex *password_lock;
 
 	/* Hash key for the loaded_connections_permissions table. */
 	gchar *hash_key;
 
 	gchar *uri;
-	gchar *username;
 	gchar *password;
 	gchar *email;
 
@@ -92,6 +92,11 @@ struct _EEwsConnectionPrivate {
 };
 
 enum {
+	PROP_0,
+	PROP_SETTINGS
+};
+
+enum {
 	AUTHENTICATE,
 	LAST_SIGNAL
 };
@@ -152,6 +157,23 @@ ews_connection_error_quark (void)
 	return quark;
 }
 
+static gboolean
+ews_auth_mech_to_use_ntlm (GBinding *binding,
+                           const GValue *source_value,
+                           GValue *target_value,
+                           gpointer user_data)
+{
+	const gchar *auth_mechanism;
+	gboolean use_ntlm;
+
+	/* Use NTLM unless the auth mechanism is "PLAIN". */
+	auth_mechanism = g_value_get_string (source_value);
+	use_ntlm = (g_strcmp0 (auth_mechanism, "PLAIN") != 0);
+	g_value_set_boolean (target_value, use_ntlm);
+
+	return TRUE;
+}
+
 static gpointer
 ews_unref_in_thread_func (gpointer data)
 {
@@ -1126,6 +1148,51 @@ create_folder_response_cb (ESoapResponse *response,
 }
 
 static void
+ews_connection_set_settings (EEwsConnection *connection,
+                             CamelEwsSettings *settings)
+{
+	g_return_if_fail (CAMEL_IS_EWS_SETTINGS (settings));
+	g_return_if_fail (connection->priv->settings == NULL);
+
+	connection->priv->settings = g_object_ref (settings);
+}
+
+static void
+ews_connection_set_property (GObject *object,
+                             guint property_id,
+                             const GValue *value,
+                             GParamSpec *pspec)
+{
+	switch (property_id) {
+		case PROP_SETTINGS:
+			ews_connection_set_settings (
+				E_EWS_CONNECTION (object),
+				g_value_get_object (value));
+			return;
+	}
+
+	G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+ews_connection_get_property (GObject *object,
+                             guint property_id,
+                             GValue *value,
+                             GParamSpec *pspec)
+{
+	switch (property_id) {
+		case PROP_SETTINGS:
+			g_value_take_object (
+				value,
+				e_ews_connection_ref_settings (
+				E_EWS_CONNECTION (object)));
+			return;
+	}
+
+	G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
 ews_connection_dispose (GObject *object)
 {
 	EEwsConnectionPrivate *priv;
@@ -1161,6 +1228,11 @@ ews_connection_dispose (GObject *object)
 		priv->soup_context = NULL;
 	}
 
+	if (priv->settings != NULL) {
+		g_object_unref (priv->settings);
+		priv->settings = NULL;
+	}
+
 	e_ews_connection_forget_password (E_EWS_CONNECTION (object));
 
 	if (priv->jobs) {
@@ -1185,7 +1257,6 @@ ews_connection_finalize (GObject *object)
 	priv = E_EWS_CONNECTION_GET_PRIVATE (object);
 
 	g_free (priv->uri);
-	g_free (priv->username);
 	g_free (priv->password);
 	g_free (priv->email);
 	g_free (priv->hash_key);
@@ -1266,11 +1337,25 @@ e_ews_connection_class_init (EEwsConnectionClass *class)
 	g_type_class_add_private (class, sizeof (EEwsConnectionPrivate));
 
 	object_class = G_OBJECT_CLASS (class);
+	object_class->set_property = ews_connection_set_property;
+	object_class->get_property = ews_connection_get_property;
 	object_class->dispose = ews_connection_dispose;
 	object_class->finalize = ews_connection_finalize;
 
 	class->authenticate = NULL;
 
+	g_object_class_install_property (
+		object_class,
+		PROP_SETTINGS,
+		g_param_spec_object (
+			"settings",
+			"Settings",
+			"Connection settings",
+			CAMEL_TYPE_EWS_SETTINGS,
+			G_PARAM_READWRITE |
+			G_PARAM_CONSTRUCT_ONLY |
+			G_PARAM_STATIC_STRINGS));
+
 	/**
 	 * EEwsConnection::authenticate
 	 **/
@@ -1347,7 +1432,8 @@ ews_connection_authenticate (SoupSession *sess,
                              gpointer data)
 {
 	EEwsConnection *cnc = data;
-	gchar *password;
+	CamelNetworkSettings *network_settings;
+	gchar *user, *password;
 
 	g_return_if_fail (cnc != NULL);
 
@@ -1355,17 +1441,22 @@ ews_connection_authenticate (SoupSession *sess,
 		e_ews_connection_forget_password (cnc);
 	}
 
+	network_settings = CAMEL_NETWORK_SETTINGS (cnc->priv->settings);
+	user = camel_network_settings_dup_user (network_settings);
+
 	g_mutex_lock (cnc->priv->password_lock);
 	password = g_strdup (cnc->priv->password);
 	g_mutex_unlock (cnc->priv->password_lock);
 
-	if (password != NULL) {
-		soup_auth_authenticate (auth, cnc->priv->username, password);
-		g_free (password);
-		return;
-	}
+	if (password != NULL)
+		soup_auth_authenticate (auth, user, password);
+	else
+		g_signal_emit (
+			cnc, signals[AUTHENTICATE], 0,
+			msg, auth, retrying);
 
-	g_signal_emit (cnc, signals[AUTHENTICATE], 0, msg, auth, retrying);
+	g_free (password);
+	g_free (user);
 }
 
 void
@@ -1406,10 +1497,13 @@ ews_user_id_free (EwsUserId *id)
 void
 e_ews_connection_authenticate (EEwsConnection *cnc,
                                SoupAuth *auth,
-                               const gchar *user,
                                const gchar *passwd,
                                GError *error)
 {
+	CamelEwsSettings *ews_settings;
+	CamelNetworkSettings *network_settings;
+	gchar *user;
+
 	g_return_if_fail (cnc != NULL);
 
 	if (error) {
@@ -1418,11 +1512,6 @@ e_ews_connection_authenticate (EEwsConnection *cnc,
 		return;
 	}
 
-	if (user) {
-		g_free (cnc->priv->username);
-		cnc->priv->username = g_strdup (user);
-	}
-
 	e_ews_connection_forget_password (cnc);
 
 	g_mutex_lock (cnc->priv->password_lock);
@@ -1430,7 +1519,14 @@ e_ews_connection_authenticate (EEwsConnection *cnc,
 	cnc->priv->password = g_strdup (passwd);
 	g_mutex_unlock (cnc->priv->password_lock);
 
+	ews_settings = e_ews_connection_ref_settings (cnc);
+	network_settings = CAMEL_NETWORK_SETTINGS (ews_settings);
+	user = camel_network_settings_dup_user (network_settings);
+	g_object_unref (ews_settings);
+
 	soup_auth_authenticate (auth, user, passwd);
+
+	g_free (user);
 }
 
 /* Connection APIS */
@@ -1478,9 +1574,8 @@ e_ews_connection_find (const gchar *uri,
 /**
  * e_ews_connection_new
  * @uri: Exchange server uri
- * @username:
  * @password:
- * @timeout: connection timeout to use, in seconds
+ * @settings: a #CamelEwsSettings
  * @error: Currently unused, but may require in future. Can take NULL value.
  *
  * This does not authenticate to the server. It merely stores the username and password.
@@ -1490,23 +1585,26 @@ e_ews_connection_find (const gchar *uri,
  **/
 EEwsConnection *
 e_ews_connection_new (const gchar *uri,
-                      const gchar *username,
                       const gchar *password,
-                      const gchar *auth_mechanism,
-                      guint timeout,
+                      CamelEwsSettings *settings,
                       GCallback authenticate_cb,
                       gpointer authenticate_ctx,
                       GError **error)
 {
+	CamelNetworkSettings *network_settings;
 	EEwsConnection *cnc;
 	gchar *hash_key;
+	gchar *user;
 
 	g_return_val_if_fail (uri != NULL, NULL);
-	g_return_val_if_fail (username != NULL, NULL);
+	g_return_val_if_fail (CAMEL_IS_EWS_SETTINGS (settings), NULL);
 
-	g_static_mutex_lock (&connecting);
+	network_settings = CAMEL_NETWORK_SETTINGS (settings);
+	user = camel_network_settings_dup_user (network_settings);
+	hash_key = g_strdup_printf ("%s %s", user, uri);
+	g_free (user);
 
-	hash_key = g_strdup_printf ("%s %s", username, uri);
+	g_static_mutex_lock (&connecting);
 
 	/* search the connection in our hash table */
 	if (loaded_connections_permissions != NULL) {
@@ -1516,12 +1614,6 @@ e_ews_connection_new (const gchar *uri,
 		if (E_IS_EWS_CONNECTION (cnc)) {
 			g_object_ref (cnc);
 
-			g_object_set (
-				G_OBJECT (cnc->priv->soup_session),
-				SOUP_SESSION_TIMEOUT, timeout,
-				SOUP_SESSION_USE_NTLM, g_strcmp0 (auth_mechanism, "PLAIN") != 0,
-				NULL);
-
 			g_free (hash_key);
 
 			g_static_mutex_unlock (&connecting);
@@ -1530,18 +1622,26 @@ e_ews_connection_new (const gchar *uri,
 	}
 
 	/* not found, so create a new connection */
-	cnc = g_object_new (E_TYPE_EWS_CONNECTION, NULL);
+	cnc = g_object_new (
+		E_TYPE_EWS_CONNECTION,
+		"settings", settings, NULL);
 
-	cnc->priv->username = g_strdup (username);
 	cnc->priv->password = g_strdup (password);
 	cnc->priv->uri = g_strdup (uri);
 	cnc->priv->hash_key = hash_key;  /* takes ownership */
 
-	g_object_set (
-		G_OBJECT (cnc->priv->soup_session),
-		SOUP_SESSION_TIMEOUT, timeout,
-		SOUP_SESSION_USE_NTLM, g_strcmp0 (auth_mechanism, "PLAIN") != 0,
-		NULL);
+	g_object_bind_property_full (
+		settings, "auth-mechanism",
+		cnc->priv->soup_session, "use-ntlm",
+		G_BINDING_SYNC_CREATE,
+		ews_auth_mech_to_use_ntlm,
+		NULL,
+		NULL, (GDestroyNotify) NULL);
+
+	g_object_bind_property (
+		settings, "timeout",
+		cnc->priv->soup_session, "timeout",
+		G_BINDING_SYNC_CREATE);
 
 	/* register a handler to the authenticate signal */
 	if (authenticate_cb)
@@ -1572,6 +1672,14 @@ e_ews_connection_get_uri (EEwsConnection *cnc)
 	return cnc->priv->uri;
 }
 
+CamelEwsSettings *
+e_ews_connection_ref_settings (EEwsConnection *cnc)
+{
+	g_return_val_if_fail (E_IS_EWS_CONNECTION (cnc), NULL);
+
+	return g_object_ref (cnc->priv->settings);
+}
+
 SoupSession *
 e_ews_connection_ref_soup_session (EEwsConnection *cnc)
 {
@@ -1597,19 +1705,6 @@ e_ews_connection_forget_password (EEwsConnection *cnc)
 	g_mutex_unlock (cnc->priv->password_lock);
 }
 
-void
-e_ews_connection_set_timeout (EEwsConnection *cnc,
-                              guint timeout)
-{
-	g_return_if_fail (cnc != NULL);
-
-	if (cnc->priv->soup_session)
-		g_object_set (
-			G_OBJECT (cnc->priv->soup_session),
-			SOUP_SESSION_TIMEOUT, timeout,
-			NULL);
-}
-
 static xmlDoc *
 e_ews_autodiscover_ws_xml (const gchar *email_address)
 {
@@ -1984,10 +2079,7 @@ e_ews_autodiscover_ws_url (CamelEwsSettings *settings,
 		user = email_address;
 
 	cnc = e_ews_connection_new (
-		url3, user, password,
-		camel_network_settings_get_auth_mechanism (network_settings),
-		camel_ews_settings_get_timeout (settings),
-		NULL, NULL, &error);
+		url3, password, settings, NULL, NULL, &error);
 	if (cnc == NULL) {
 		g_free (url1);
 		g_free (url2);
diff --git a/src/server/e-ews-connection.h b/src/server/e-ews-connection.h
index 6bc2387..14b0b81 100644
--- a/src/server/e-ews-connection.h
+++ b/src/server/e-ews-connection.h
@@ -179,25 +179,22 @@ void		ews_oal_details_free		(EwsOALDetails *details);
 
 GType		e_ews_connection_get_type	(void);
 EEwsConnection *e_ews_connection_new		(const gchar *uri,
-						 const gchar *username,
 						 const gchar *password,
-						 const gchar *auth_mechanism,
-						 guint timeout,
+						 CamelEwsSettings *settings,
 						 GCallback authenticate_cb,
 						 gpointer authenticate_ctx,
 						 GError **error);
 const gchar *	e_ews_connection_get_uri	(EEwsConnection *cnc);
+CamelEwsSettings *
+		e_ews_connection_ref_settings	(EEwsConnection *cnc);
 SoupSession *	e_ews_connection_ref_soup_session
 						(EEwsConnection *cnc);
 void		e_ews_connection_forget_password
 						(EEwsConnection *cnc);
-void		e_ews_connection_set_timeout	(EEwsConnection *cnc,
-						 guint timeout);
 EEwsConnection *e_ews_connection_find		(const gchar *uri,
 						 const gchar *username);
 void		e_ews_connection_authenticate	(EEwsConnection *cnc,
 						 SoupAuth *auth,
-						 const gchar *user,
 						 const gchar *passwd,
 						 GError *error);
 void		e_ews_connection_queue_request	(EEwsConnection *cnc,
diff --git a/src/server/tests/test-autocompletion.c b/src/server/tests/test-autocompletion.c
index 99fe547..c2c1779 100644
--- a/src/server/tests/test-autocompletion.c
+++ b/src/server/tests/test-autocompletion.c
@@ -80,6 +80,7 @@ op_test_resolve_names ()
 	const gchar *uri;
 	EEwsConnection *cnc;
 	GCancellable *cancellable;
+	CamelEwsSettings *settings;
 
 	cancellable = g_cancellable_new ();
 
@@ -88,8 +89,16 @@ op_test_resolve_names ()
 	g_assert_cmpstr (password, !=, NULL);
 	g_assert_cmpstr (uri, !=, NULL);
 
-	cnc = e_ews_connection_new (uri, username, password, NULL, 30, NULL, NULL, NULL);
+	settings = g_object_new (
+		CAMEL_TYPE_EWS_SETTINGS,
+		"user", username, NULL);
+
+	cnc = e_ews_connection_new (
+		uri, password, settings, NULL, NULL, NULL);
 	g_assert (cnc != NULL);
+
+	g_object_unref (settings);
+
 	e_ews_connection_resolve_names (
 		cnc, EWS_PRIORITY_MEDIUM, username,
 		EWS_SEARCH_AD, NULL, FALSE, cancellable,
diff --git a/src/server/tests/test-connection.c b/src/server/tests/test-connection.c
index 157dfd6..17ca399 100644
--- a/src/server/tests/test-connection.c
+++ b/src/server/tests/test-connection.c
@@ -48,15 +48,23 @@ con_test_create_new_connection ()
 	const gchar *password;
 	const gchar *uri;
 	EEwsConnection *cnc;
+	CamelEwsSettings *settings;
 
 	util_get_login_info_from_env (&username, &password, &uri);
 	g_assert_cmpstr (username, !=, NULL);
 	g_assert_cmpstr (password, !=, NULL);
 	g_assert_cmpstr (uri, !=, NULL);
 
-	cnc = e_ews_connection_new (uri, username, password, NULL, 30, NULL, NULL, NULL);
+	settings = g_object_new (
+		CAMEL_TYPE_EWS_SETTINGS,
+		"user", username, NULL);
+
+	cnc = e_ews_connection_new (
+		uri, password, settings, NULL, NULL, NULL);
 	g_assert (cnc != NULL);
 
+	g_object_unref (settings);
+
 	g_print ("\nSuccess : Created a new connection\n");
 
 	/* Quit the test suite */
diff --git a/src/server/tests/test-createfolder.c b/src/server/tests/test-createfolder.c
index 9eb46b7..a4f1a10 100644
--- a/src/server/tests/test-createfolder.c
+++ b/src/server/tests/test-createfolder.c
@@ -77,6 +77,7 @@ op_test_create_folder ()
 	const gchar *uri;
 	EEwsConnection *cnc;
 	GCancellable *cancellable;
+	CamelEwsSettings *settings;
 
 	cancellable = g_cancellable_new ();
 
@@ -85,8 +86,16 @@ op_test_create_folder ()
 	g_assert_cmpstr (password, !=, NULL);
 	g_assert_cmpstr (uri, !=, NULL);
 
-	cnc = e_ews_connection_new (uri, username, password, NULL, 30, NULL, NULL, NULL);
+	settings = g_object_new (
+		CAMEL_TYPE_EWS_SETTINGS,
+		"user", username, NULL);
+
+	cnc = e_ews_connection_new (
+		uri, password, settings, NULL, NULL, NULL);
 	g_assert (cnc != NULL);
+
+	g_object_unref (settings);
+
 	e_ews_connection_create_folder (
 		cnc, EWS_PRIORITY_MEDIUM, "inbox",
 		TRUE ,"test", cancellable,
diff --git a/src/server/tests/test-cuditem.c b/src/server/tests/test-cuditem.c
index fec1798..94bbbaf 100644
--- a/src/server/tests/test-cuditem.c
+++ b/src/server/tests/test-cuditem.c
@@ -100,6 +100,7 @@ op_test_create_item ()
 	const gchar *folderid;
 	EEwsConnection *cnc;
 	GCancellable *cancellable;
+	CamelEwsSettings *settings;
 
 	cancellable = g_cancellable_new ();
 
@@ -108,9 +109,16 @@ op_test_create_item ()
 	g_assert_cmpstr (password, !=, NULL);
 	g_assert_cmpstr (uri, !=, NULL);
 
-	cnc = e_ews_connection_new (uri, username, password, NULL, 30, NULL, NULL, NULL);
+	settings = g_object_new (
+		CAMEL_TYPE_EWS_SETTINGS,
+		"user", username, NULL);
+
+	cnc = e_ews_connection_new (
+		uri, password, settings, NULL, NULL, NULL);
 	g_assert (cnc != NULL);
 
+	g_object_unref (settings);
+
 	//to check how to change to real data
 	folderid = "AQASAG1hbmR5Lnd1QGludGVsLmNvbQAuAAADnUl3sZrICU6Xd1qXV+rpVwEAJvRPgQpR30KhJ7wqBr4YXgAAAY6W+gAAAA==";
 
diff --git a/src/server/tests/test-deletefolder.c b/src/server/tests/test-deletefolder.c
index d7b9bc7..3080e0a 100644
--- a/src/server/tests/test-deletefolder.c
+++ b/src/server/tests/test-deletefolder.c
@@ -67,6 +67,7 @@ op_test_delete_folder (gpointer data)
 	const gchar *uri;
 	EEwsConnection *cnc;
 	GCancellable *cancellable;
+	CamelEwsSettings *settings;
 	EwsFolderId **fid = (EwsFolderId **) data;
 
 	cancellable = g_cancellable_new ();
@@ -76,8 +77,16 @@ op_test_delete_folder (gpointer data)
 	g_assert_cmpstr (password, !=, NULL);
 	g_assert_cmpstr (uri, !=, NULL);
 
-	cnc = e_ews_connection_new (uri, username, password, NULL, 30, NULL, NULL, NULL);
+	settings = g_object_new (
+		CAMEL_TYPE_EWS_SETTINGS,
+		"user", username, NULL);
+
+	cnc = e_ews_connection_new (
+		uri, password, settings, NULL, NULL, NULL);
 	g_assert (cnc != NULL);
+
+	g_object_unref (settings);
+
 	e_ews_connection_delete_folder (
 		cnc, EWS_PRIORITY_MEDIUM, (*fid)->id,
 		FALSE ,"HardDelete", cancellable,
diff --git a/src/server/tests/test-get-oof-settings.c b/src/server/tests/test-get-oof-settings.c
index de8d825..4c336dd 100644
--- a/src/server/tests/test-get-oof-settings.c
+++ b/src/server/tests/test-get-oof-settings.c
@@ -66,6 +66,7 @@ op_test_get_oof_settings ()
 	const gchar *uri, *email;
 	EEwsConnection *cnc;
 	GCancellable *cancellable;
+	CamelEwsSettings *settings;
 
 	cancellable = g_cancellable_new ();
 
@@ -77,9 +78,16 @@ op_test_get_oof_settings ()
 	g_assert_cmpstr (uri, !=, NULL);
 	g_assert_cmpstr (email, !=, NULL);
 
-	cnc = e_ews_connection_new (uri, username, password, NULL, 30, NULL, NULL, NULL);
+	settings = g_object_new (
+		CAMEL_TYPE_EWS_SETTINGS,
+		"username", username, NULL);
+
+	cnc = e_ews_connection_new (
+		uri, password, settings, NULL, NULL, NULL);
 	g_assert (cnc != NULL);
 
+	g_object_unref (settings);
+
 	e_ews_connection_set_mailbox (cnc, email);
 
 	e_ews_connection_get_oof_settings (
diff --git a/src/server/tests/test-getattachment.c b/src/server/tests/test-getattachment.c
index d772172..111e13c 100644
--- a/src/server/tests/test-getattachment.c
+++ b/src/server/tests/test-getattachment.c
@@ -72,8 +72,10 @@ op_test_get_attachments ()
 	const gchar *attachmentid;
 	EEwsConnection *cnc;
 	GCancellable *cancellable;
+	CamelEwsSettings *settings;
 	GSList *ids = NULL;
 	gchar *tmpdir;
+
 	cancellable = g_cancellable_new ();
 
 	util_get_login_info_from_env (&username, &password, &uri);
@@ -81,9 +83,16 @@ op_test_get_attachments ()
 	g_assert_cmpstr (password, !=, NULL);
 	g_assert_cmpstr (uri, !=, NULL);
 
-	cnc = e_ews_connection_new (uri, username, password, NULL, 30, NULL, NULL, NULL);
+	settings = g_object_new (
+		CAMEL_TYPE_EWS_SETTINGS,
+		"user", username, NULL);
+
+	cnc = e_ews_connection_new (
+		uri, password, settings, NULL, NULL, NULL);
 	g_assert (cnc != NULL);
 
+	g_object_unref (settings);
+
 	attachmentid = "AAASAG1hbmR5Lnd1QGludGVsLmNvbQBGAAAAAACdSXexmsgJTpd3WpdX6ulXBwAm9E+BClHfQqEnvCoGvhheAAAAjpb6AACIeDU1D80fTrC3245yXdhOADUAPRB8AAABEgAQAIlh9YZzdzdMtvWW9ZI7+vM=";
 	ids = g_slist_append (ids, (gpointer *) attachmentid);
 	attachmentid = "AAASAG1hbmR5Lnd1QGludGVsLmNvbQBGAAAAAACdSXexmsgJTpd3WpdX6ulXBwAm9E+BClHfQqEnvCoGvhheAAAAjpb6AACIeDU1D80fTrC3245yXdhOADUAPRB8AAABEgAQADgh/XHkRSZEoCsn9BHi5Fc=";
diff --git a/src/server/tests/test-getdelegate.c b/src/server/tests/test-getdelegate.c
index 99b3baa..172e1f7 100644
--- a/src/server/tests/test-getdelegate.c
+++ b/src/server/tests/test-getdelegate.c
@@ -76,6 +76,7 @@ op_test_get_delegate ()
 	const gchar *uri;
 	EEwsConnection *cnc;
 	GCancellable *cancellable;
+	CamelEwsSettings *settings;
 
 	cancellable = g_cancellable_new ();
 
@@ -84,8 +85,16 @@ op_test_get_delegate ()
 	g_assert_cmpstr (password, !=, NULL);
 	g_assert_cmpstr (uri, !=, NULL);
 
-	cnc = e_ews_connection_new (uri, username, password, NULL, 30, NULL, NULL, NULL);
+	settings = g_object_new (
+		CAMEL_TYPE_EWS_SETTINGS,
+		"user", username, NULL);
+
+	cnc = e_ews_connection_new (
+		uri, password, settings, NULL, NULL, NULL);
 	g_assert (cnc != NULL);
+
+	g_object_unref (settings);
+
 	e_ews_connection_get_delegate (
 		cnc, EWS_PRIORITY_MEDIUM, "abc xyz com",
 		"true", cancellable,
diff --git a/src/server/tests/test-set-oof-settings.c b/src/server/tests/test-set-oof-settings.c
index 76bfbb0..ba03418 100644
--- a/src/server/tests/test-set-oof-settings.c
+++ b/src/server/tests/test-set-oof-settings.c
@@ -81,6 +81,7 @@ op_test_set_oof_settings ()
 	const gchar *uri, *email;
 	EEwsConnection *cnc;
 	GCancellable *cancellable;
+	CamelEwsSettings *settings;
 
 	cancellable = g_cancellable_new ();
 
@@ -92,9 +93,16 @@ op_test_set_oof_settings ()
 	g_assert_cmpstr (uri, !=, NULL);
 	g_assert_cmpstr (email, !=, NULL);
 
-	cnc = e_ews_connection_new (uri, username, password, NULL, 30, NULL, NULL, NULL);
+	settings = g_object_new (
+		CAMEL_TYPE_EWS_SETTINGS,
+		"user", username, NULL);
+
+	cnc = e_ews_connection_new (
+		uri, password, settings, NULL, NULL, NULL);
 	g_assert (cnc != NULL);
 
+	g_object_unref (settings);
+
 	e_ews_connection_set_mailbox (cnc, email);
 
 	set_arbit_values ();
diff --git a/src/server/tests/test-syncfolder.c b/src/server/tests/test-syncfolder.c
index fe0ed7c..4bc2bac 100644
--- a/src/server/tests/test-syncfolder.c
+++ b/src/server/tests/test-syncfolder.c
@@ -91,6 +91,7 @@ op_test_sync_folder_items ()
 	const gchar *uri;
 	EEwsConnection *cnc;
 	GCancellable *cancellable;
+	CamelEwsSettings *settings;
 	/* const gchar *sync_state = NULL; */
 
 	cancellable = g_cancellable_new ();
@@ -100,9 +101,16 @@ op_test_sync_folder_items ()
 	g_assert_cmpstr (password, !=, NULL);
 	g_assert_cmpstr (uri, !=, NULL);
 
-	cnc = e_ews_connection_new (uri, username, password, NULL, 30, NULL, NULL, NULL);
+	settings = g_object_new (
+		CAMEL_TYPE_EWS_SETTINGS,
+		"user", username, NULL);
+
+	cnc = e_ews_connection_new (
+		uri, password, settings, NULL, NULL, NULL);
 	g_assert (cnc != NULL);
 
+	g_object_unref (settings);
+
 	e_ews_connection_sync_folder_items (
 		cnc, EWS_PRIORITY_MEDIUM,
 		NULL, folder_id->id,
@@ -165,6 +173,7 @@ op_test_sync_folder_hierarchy ()
 	const gchar *uri;
 	EEwsConnection *cnc;
 	GCancellable *cancellable;
+	CamelEwsSettings *settings;
 
 	cancellable = g_cancellable_new ();
 
@@ -173,9 +182,16 @@ op_test_sync_folder_hierarchy ()
 	g_assert_cmpstr (password, !=, NULL);
 	g_assert_cmpstr (uri, !=, NULL);
 
-	cnc = e_ews_connection_new (uri, username, password, NULL, 30, NULL, NULL, NULL);
+	settings = g_object_new (
+		CAMEL_TYPE_EWS_SETTINGS,
+		"user", username, NULL);
+
+	cnc = e_ews_connection_new (
+		uri, password, settings, NULL, NULL, NULL);
 	g_assert (cnc != NULL);
 
+	g_object_unref (settings);
+
 	e_ews_connection_sync_folder_hierarchy (
 		cnc, EWS_PRIORITY_MEDIUM,
 		NULL, cancellable,
@@ -226,6 +242,7 @@ op_test_get_item ()
 	const gchar *uri;
 	EEwsConnection *cnc;
 	GCancellable *cancellable;
+	CamelEwsSettings *settings;
 
 	cancellable = g_cancellable_new ();
 
@@ -234,9 +251,16 @@ op_test_get_item ()
 	g_assert_cmpstr (password, !=, NULL);
 	g_assert_cmpstr (uri, !=, NULL);
 
-	cnc = e_ews_connection_new (uri, username, password, NULL, 30, NULL, NULL, NULL);
+	settings = g_object_new (
+		CAMEL_TYPE_EWS_SETTINGS,
+		"user", username, NULL);
+
+	cnc = e_ews_connection_new (
+		uri, password, settings, NULL, NULL, NULL);
 	g_assert (cnc != NULL);
 
+	g_object_unref (settings);
+
 	ids = g_slist_reverse (ids);
 	e_ews_connection_get_items (
 		cnc, EWS_PRIORITY_MEDIUM,
diff --git a/src/utils/ews-test-finditem-query.c b/src/utils/ews-test-finditem-query.c
index b6e6609..364e7ee 100644
--- a/src/utils/ews-test-finditem-query.c
+++ b/src/utils/ews-test-finditem-query.c
@@ -103,6 +103,7 @@ op_test_finditem_run (void)
 	EEwsConnection *cnc;
 	EwsFolderType folder_type;
 	EwsFolderId *fid = NULL;
+	CamelEwsSettings *settings;
 	GCancellable *cancellable;
 
 	cancellable = g_cancellable_new ();
@@ -112,9 +113,16 @@ op_test_finditem_run (void)
 	g_assert_cmpstr (password, !=, NULL);
 	g_assert_cmpstr (uri, !=, NULL);
 
-	cnc = e_ews_connection_new (uri, username, password, NULL, 30, NULL, NULL, NULL);
+	settings = g_object_new (
+		CAMEL_TYPE_EWS_SETTINGS,
+		"user", username, NULL);
+
+	cnc = e_ews_connection_new (
+		uri, password, settings, NULL, NULL, NULL);
 	g_assert (cnc != NULL);
 
+	g_object_unref (settings);
+
 	/*Along with finditem api we check query conversion too*/
 
 	/*Check for contact folder*/



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