[evolution-kolab/account-mgmt: 5/6] Get host/user from CamelKolabIMAPXSettings.



commit 61818856924e77fc5d8619c01dc9f4bdcebaa05a
Author: Matthew Barnes <mbarnes redhat com>
Date:   Thu Jun 21 14:51:58 2012 -0400

    Get host/user from CamelKolabIMAPXSettings.

 src/addressbook/e-book-backend-kolab.c |   15 +++++++--------
 src/calendar/e-cal-backend-kolab.c     |   15 +++++++--------
 2 files changed, 14 insertions(+), 16 deletions(-)
---
diff --git a/src/addressbook/e-book-backend-kolab.c b/src/addressbook/e-book-backend-kolab.c
index 79b44d7..cfec43a 100644
--- a/src/addressbook/e-book-backend-kolab.c
+++ b/src/addressbook/e-book-backend-kolab.c
@@ -234,7 +234,8 @@ e_book_backend_kolab_open (EBookBackendSync *backend,
 	EBookBackendKolab *self = NULL;
 	EBookBackendKolabPrivate *priv = NULL;
 	ESource *esource = NULL;
-	CamelURL *c_url = NULL;
+	CamelKolabIMAPXSettings *kolab_settings;
+	CamelNetworkSettings *network_settings;
 	KolabSettingsHandler *ksettings = NULL;
 	KolabMailAccess *tmp_koma = NULL;
 	KolabSyncStrategyID sync_value = KOLAB_SYNC_STRATEGY_DEFAULT;
@@ -275,12 +276,12 @@ e_book_backend_kolab_open (EBookBackendSync *backend,
 	}
 
 	priv->book_uri = e_source_get_uri (esource);
-	c_url = camel_url_new (priv->book_uri, &tmp_err);
-	if (c_url == NULL)
-		goto exit;
 
-	servername = g_strdup (c_url->host);
-	username = g_strdup (c_url->user);
+	kolab_settings = book_backend_kolab_get_collection_settings (self);
+	network_settings = CAMEL_NETWORK_SETTINGS (kolab_settings);
+
+	servername = camel_network_settings_dup_host (network_settings);
+	username = camel_network_settings_dup_user (network_settings);
 	g_debug ("%s()[%u] servername = %s", __func__, __LINE__, servername);
 	g_debug ("%s()[%u]   username = %s", __func__, __LINE__, username);
 
@@ -413,8 +414,6 @@ e_book_backend_kolab_open (EBookBackendSync *backend,
 
 	g_mutex_unlock (&koma_objects_lock);
 
-	if (c_url != NULL)
-		camel_url_free (c_url);
 	if (servername != NULL)
 		g_free (servername);
 	if (username != NULL)
diff --git a/src/calendar/e-cal-backend-kolab.c b/src/calendar/e-cal-backend-kolab.c
index 5b7ff3f..26690fd 100644
--- a/src/calendar/e-cal-backend-kolab.c
+++ b/src/calendar/e-cal-backend-kolab.c
@@ -257,7 +257,8 @@ e_cal_backend_kolab_open (ECalBackendSync *backend,
 	ECalBackendKolab *self = NULL;
 	ECalBackendKolabPrivate *priv = NULL;
 	ESource *esource = NULL;
-	CamelURL *c_url = NULL;
+	CamelKolabIMAPXSettings *kolab_settings;
+	CamelNetworkSettings *network_settings;
 	KolabSettingsHandler *ksettings = NULL;
 	KolabMailAccess *tmp_koma = NULL;
 	KolabSyncStrategyID sync_value = KOLAB_SYNC_STRATEGY_DEFAULT;
@@ -319,12 +320,12 @@ e_cal_backend_kolab_open (ECalBackendSync *backend,
 	}
 
 	priv->cal_uri = e_source_get_uri (esource);
-	c_url = camel_url_new (priv->cal_uri, &tmp_err);
-	if (c_url == NULL)
-		goto exit;
 
-	servername = g_strdup (c_url->host);
-	username = g_strdup (c_url->user);
+	kolab_settings = cal_backend_kolab_get_collection_settings (self);
+	network_settings = CAMEL_NETWORK_SETTINGS (kolab_settings);
+
+	servername = camel_network_settings_dup_host (network_settings);
+	username = camel_network_settings_dup_user (network_settings);
 	g_debug ("%s()[%u] servername = %s", __func__, __LINE__, servername);
 	g_debug ("%s()[%u]   username = %s", __func__, __LINE__, username);
 
@@ -463,8 +464,6 @@ e_cal_backend_kolab_open (ECalBackendSync *backend,
 
 	g_mutex_unlock (&koma_objects_lock);
 
-	if (c_url != NULL)
-		camel_url_free (c_url);
 	if (servername != NULL)
 		g_free (servername);
 	if (username != NULL)



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