evolution-exchange r1689 - branches/gnome-2-22/calendar
- From: pohly svn gnome org
- To: svn-commits-list gnome org
- Subject: evolution-exchange r1689 - branches/gnome-2-22/calendar
- Date: Sun, 22 Jun 2008 12:00:38 +0000 (UTC)
Author: pohly
Date: Sun Jun 22 12:00:38 2008
New Revision: 1689
URL: http://svn.gnome.org/viewvc/evolution-exchange?rev=1689&view=rev
Log:
GNOME Bugzilla #52890: improved time zone handling in Evolution Exchange backend
Use e_cal_check_timezones() to match time zone definitions and handle conflicting definitions; requires a new utility function to look up time zone definitions cached in the backend.
Modified:
branches/gnome-2-22/calendar/e-cal-backend-exchange-calendar.c
branches/gnome-2-22/calendar/e-cal-backend-exchange.c
branches/gnome-2-22/calendar/e-cal-backend-exchange.h
Modified: branches/gnome-2-22/calendar/e-cal-backend-exchange-calendar.c
==============================================================================
--- branches/gnome-2-22/calendar/e-cal-backend-exchange-calendar.c (original)
+++ branches/gnome-2-22/calendar/e-cal-backend-exchange-calendar.c Sun Jun 22 12:00:38 2008
@@ -25,6 +25,8 @@
#include <sys/stat.h>
#include <sys/fcntl.h>
+#include <libecal/e-cal-check-timezones.h>
+
#include "e-cal-backend-exchange-calendar.h"
#include "e2k-cal-utils.h"
@@ -64,6 +66,8 @@
gboolean check_for_send_options (icalcomponent *icalcomp, E2kProperties *props);
static void update_x_properties (ECalBackendExchange *cbex, ECalComponent *comp);
+
+
static void
add_timezones_from_comp (ECalBackendExchange *cbex, icalcomponent *icalcomp)
{
@@ -196,6 +200,8 @@
GSList *attachment_list = NULL;
gboolean status;
ECalBackend *backend = E_CAL_BACKEND (cbex);
+ GError *error = NULL;
+ gboolean retval = TRUE;
/* Check for attachments */
if (uid)
@@ -248,12 +254,20 @@
icalcomponent_free (icalcomp);
return status;
} else if (kind != ICAL_VCALENDAR_COMPONENT) {
- icalcomponent_free (icalcomp);
- if (attachment_list) {
- g_slist_foreach (attachment_list, (GFunc) g_free, NULL);
- g_slist_free (attachment_list);
- }
- return FALSE;
+ retval = FALSE;
+ goto cleanup;
+ }
+
+ /* map time zones against system time zones and handle conflicting definitions */
+ if (!e_cal_check_timezones (icalcomp,
+ NULL,
+ e_cal_backend_exchange_lookup_timezone,
+ cbex,
+ &error)) {
+ g_warning ("checking timezones failed: %s", error->message);
+ g_clear_error (&error);
+ retval = FALSE;
+ goto cleanup;
}
add_timezones_from_comp (cbex, icalcomp);
@@ -285,13 +299,15 @@
subcomp = icalcomponent_get_next_component (
icalcomp, ICAL_VEVENT_COMPONENT);
}
+
+ cleanup:
icalcomponent_free (icalcomp);
if (attachment_list) {
g_slist_foreach (attachment_list, (GFunc) g_free, NULL);
g_slist_free (attachment_list);
}
- return TRUE;
+ return retval;
}
static const char *event_properties[] = {
@@ -1563,6 +1579,7 @@
icalproperty_method method;
icalcomponent *subcomp, *icalcomp;
ECalBackendSyncStatus status = GNOME_Evolution_Calendar_Success;
+ GError *error = NULL;
d(printf ("ecbexc_modify_object(%p, %p, %s)", backend, cal, calobj ? calobj : NULL));
cbexc = E_CAL_BACKEND_EXCHANGE_CALENDAR (backend);
@@ -1582,6 +1599,20 @@
return GNOME_Evolution_Calendar_InvalidObject;
icalcomp = icalparser_parse_string (calobj);
+
+ /* map time zones against system time zones and handle conflicting definitions */
+ if (icalcomp &&
+ !e_cal_check_timezones (icalcomp,
+ comps,
+ e_cal_backend_exchange_lookup_timezone,
+ cbex,
+ &error)) {
+ g_warning ("checking timezones failed: %s", error->message);
+ icalcomponent_free (icalcomp);
+ g_clear_error (&error);
+ return GNOME_Evolution_Calendar_InvalidObject;
+ }
+
add_timezones_from_comp (E_CAL_BACKEND_EXCHANGE (backend), icalcomp);
icalcomponent_free (icalcomp);
@@ -1977,10 +2008,11 @@
ECalBackendExchange *cbex = (ECalBackendExchange *) backend;
ECalBackendSyncStatus retval = GNOME_Evolution_Calendar_Success;
ECalBackendExchangeBookingResult result;
- ECalComponent *comp;
- icalcomponent *top_level, *icalcomp, *tzcomp;
+ ECalComponent *comp = NULL;
+ icalcomponent *top_level = NULL, *icalcomp, *tzcomp;
icalproperty *prop;
icalproperty_method method;
+ GError *error = NULL;
g_return_val_if_fail (E_IS_CAL_BACKEND_EXCHANGE (cbex),
GNOME_Evolution_Calendar_InvalidObject);
@@ -1993,6 +2025,20 @@
*modified_calobj = NULL;
top_level = icalparser_parse_string (calobj);
+
+ /* map time zones against system time zones and handle conflicting definitions */
+ if (top_level &&
+ !e_cal_check_timezones (top_level,
+ NULL,
+ e_cal_backend_exchange_lookup_timezone,
+ cbex,
+ &error)) {
+ g_warning ("checking timezones failed: %s", error->message);
+ g_clear_error (&error);
+ retval = FALSE;
+ goto cleanup;
+ }
+
icalcomp = icalcomponent_new_clone (icalcomponent_get_inner (top_level));
comp = e_cal_component_new ();
@@ -2008,13 +2054,7 @@
}
/* traverse all timezones to add them to the backend */
- tzcomp = icalcomponent_get_first_component (top_level,
- ICAL_VTIMEZONE_COMPONENT);
- while (tzcomp) {
- e_cal_backend_exchange_add_timezone (cbex, tzcomp);
- tzcomp = icalcomponent_get_next_component (top_level,
- ICAL_VTIMEZONE_COMPONENT);
- }
+ add_timezones_from_comp (cbex, top_level);
for (prop = icalcomponent_get_first_property (icalcomp, ICAL_ATTENDEE_PROPERTY);
prop != NULL;
@@ -2083,8 +2123,12 @@
*modified_calobj = g_strdup (e_cal_component_get_as_string (comp));
cleanup:
- icalcomponent_free (top_level);
- g_object_unref (comp);
+ if (top_level) {
+ icalcomponent_free (top_level);
+ }
+ if (comp) {
+ g_object_unref (comp);
+ }
return retval;
}
Modified: branches/gnome-2-22/calendar/e-cal-backend-exchange.c
==============================================================================
--- branches/gnome-2-22/calendar/e-cal-backend-exchange.c (original)
+++ branches/gnome-2-22/calendar/e-cal-backend-exchange.c Sun Jun 22 12:00:38 2008
@@ -1961,6 +1961,15 @@
return g_hash_table_lookup (cbex->priv->timezones, tzid);
}
+icaltimezone *
+e_cal_backend_exchange_lookup_timezone (const char *tzid,
+ const void *custom,
+ GError **error)
+{
+ return internal_get_timezone (E_CAL_BACKEND ((ECalBackendExchange *)custom),
+ tzid);
+}
+
static void
free_exchange_comp (gpointer value)
Modified: branches/gnome-2-22/calendar/e-cal-backend-exchange.h
==============================================================================
--- branches/gnome-2-22/calendar/e-cal-backend-exchange.h (original)
+++ branches/gnome-2-22/calendar/e-cal-backend-exchange.h Sun Jun 22 12:00:38 2008
@@ -80,6 +80,12 @@
ECalBackendSyncStatus get_timezone (ECalBackendSync *backend,
EDataCal *cal, const char *tzid, char **object);
+/** lookup function for e_cal_check_timezones() */
+icaltimezone *
+e_cal_backend_exchange_lookup_timezone (const char *tzid,
+ const void *custom,
+ GError **error);
+
ECalBackendExchangeComponent * get_exchange_comp (ECalBackendExchange *cbex,
const char *uid);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]