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



commit 89578fd019872f865149866230ece07690c353da
Author: James Bottomley <JBottomley Parallels com>
Date:   Sat Jul 16 20:01:18 2011 -0500

    evolution-ews: fix calendar failure when specifying UTC as the TimeZone
    
    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>

 src/calendar/e-cal-backend-ews-utils.c |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/src/calendar/e-cal-backend-ews-utils.c b/src/calendar/e-cal-backend-ews-utils.c
index 0bb5044..a543e61 100644
--- a/src/calendar/e-cal-backend-ews-utils.c
+++ b/src/calendar/e-cal-backend-ews-utils.c
@@ -281,10 +281,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. */
@@ -305,8 +301,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]