[evolution-kolab] ECalBackendKolab: get email address via backend's ESource
- From: Christian Hilberg <chilberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-kolab] ECalBackendKolab: get email address via backend's ESource
- Date: Wed, 24 Oct 2012 13:38:11 +0000 (UTC)
commit c2aaba88477957b441081b55b87d2a1250561f09
Author: Christian Hilberg <hilberg kernelconcepts de>
Date: Wed Oct 24 15:34:18 2012 +0200
ECalBackendKolab: get email address via backend's ESource
* use the new util function for getting the user's
email address via ESourceRegistry search
* fall back to synthesizing an email address from
username and hostname only if the former fails
(which should not normally be the case)
src/calendar/e-cal-backend-kolab.c | 21 ++++++++++++++-------
1 files changed, 14 insertions(+), 7 deletions(-)
---
diff --git a/src/calendar/e-cal-backend-kolab.c b/src/calendar/e-cal-backend-kolab.c
index f0bdf4b..119cb3b 100644
--- a/src/calendar/e-cal-backend-kolab.c
+++ b/src/calendar/e-cal-backend-kolab.c
@@ -326,16 +326,23 @@ cal_backend_kolab_open (ECalBackendSync *backend,
g_debug ("%s()[%u] servername = %s", __func__, __LINE__, servername);
g_debug ("%s()[%u] username = %s", __func__, __LINE__, username);
- /* TODO this is sort of hackish, we cannot be sure that
- * 'user server' is truly the Kolab email address
- * of the Kolab user
- */
- priv->user_email = g_strdup_printf ("%s %s", username, servername);
+ priv->user_email = kolab_util_calendar_dup_email_address (E_CAL_BACKEND (backend));
+ if (priv->user_email == NULL) {
+ /* fallback if getting mail address from
+ * ESource failed - synthesized one is just
+ * guessing!
+ */
+ if (g_str_has_suffix (username, servername))
+ priv->user_email = g_strdup (username);
+ else
+ priv->user_email = g_strdup_printf ("%s %s", username, servername);
+ g_warning ("%s()[%u] Could not get email address from ESource, synthesized '%s'",
+ __func__, __LINE__, priv->user_email);
+ }
/* Initialize backend cache */
- if (priv->cal_cache != NULL) {
+ if (priv->cal_cache != NULL)
g_object_unref (priv->cal_cache);
- }
cache_dir = e_cal_backend_get_cache_dir (E_CAL_BACKEND (backend));
cache_filename = g_build_filename (cache_dir, "cache.xml", NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]