[Evolution-hackers] [PATCH] evolution-ews: fix calendar failure when specifying UTC as the TimeZone



From: James Bottomley <JBottomley Parallels com>

If you use evolution to specify an appointment in UTC, currently it
gets translated as native time in whatever timezone the exchange
server happens to be running.

The bug is that the UTC timezone has no properties, so the check for
standard properties in ewscal_set_timezone() fails.  Fix by assuming
that if the timezone has no properties, it must be UTC.

Signed-off-by: James Bottomley <JBottomley Parallels com>

diff --git a/src/calendar/e-cal-backend-ews-utils.c b/src/calendar/e-cal-backend-ews-utils.c
index 7489bfd..933d426 100644
--- a/src/calendar/e-cal-backend-ews-utils.c
+++ b/src/calendar/e-cal-backend-ews-utils.c
@@ -228,10 +228,6 @@ void ewscal_set_timezone (ESoapMessage *msg, const gchar *name, icaltimezone *ic
 	xstd = icalcomponent_get_first_component(comp, ICAL_XSTANDARD_COMPONENT);
 	xdaylight = icalcomponent_get_first_component(comp, ICAL_XDAYLIGHT_COMPONENT);
 
-	/* Should never happen. RFC5545 requires at least one */
-	if (!xstd && !xdaylight)
-		return;
-
 	/* If there was only a DAYLIGHT component, swap them over and pretend
 	   it was the STANDARD component. We're only going to give the server
 	   the BaseOffset anyway. */
@@ -252,8 +248,13 @@ void ewscal_set_timezone (ESoapMessage *msg, const gchar *name, icaltimezone *ic
 
 	/* Fetch the timezone offsets for the standard (or only) zone.
 	   Negate it, because Exchange does it backwards */
-	prop = icalcomponent_get_first_property(xstd, ICAL_TZOFFSETTO_PROPERTY);
-	std_utcoffs = -icalproperty_get_tzoffsetto(prop);
+	if (xstd) {
+		prop = icalcomponent_get_first_property(xstd, ICAL_TZOFFSETTO_PROPERTY);
+		std_utcoffs = -icalproperty_get_tzoffsetto(prop);
+	} else {
+		/* UTC has no properties at all, so just set manually */
+		std_utcoffs = 0;
+	}
 
 	/* This is the overall BaseOffset tag, which the Standard and Daylight
 	   zones are offset from. It's redundant, but Exchange always sets it




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