[evolution-mapi] Bug #649898 - Modified recurrences have incorrect time



commit 44f3792149ef9399b043efe654ae06c74c675320
Author: Milan Crha <mcrha redhat com>
Date:   Mon May 16 15:06:04 2011 +0200

    Bug #649898 - Modified recurrences have incorrect time

 .../exchange-mapi-cal-recur-utils.c                |    8 ++++----
 .../exchange-mapi-cal-recur-utils.h                |    6 ++----
 src/libexchangemapi/exchange-mapi-cal-utils.c      |   10 +++++++++-
 3 files changed, 15 insertions(+), 9 deletions(-)
---
diff --git a/src/libexchangemapi/exchange-mapi-cal-recur-utils.c b/src/libexchangemapi/exchange-mapi-cal-recur-utils.c
index 7c4c2f1..458d499 100644
--- a/src/libexchangemapi/exchange-mapi-cal-recur-utils.c
+++ b/src/libexchangemapi/exchange-mapi-cal-recur-utils.c
@@ -699,7 +699,7 @@ check_calendar_type (guint16 type)
 }
 
 gboolean
-exchange_mapi_cal_util_bin_to_rrule (GByteArray *ba, ECalComponent *comp, GSList **extra_detached)
+exchange_mapi_cal_util_bin_to_rrule (GByteArray *ba, ECalComponent *comp, GSList **extra_detached, icaltimezone *recur_zone)
 {
 	struct icalrecurrencetype rt;
 	struct ema_AppointmentRecurrencePattern arp;
@@ -937,17 +937,17 @@ exchange_mapi_cal_util_bin_to_rrule (GByteArray *ba, ECalComponent *comp, GSList
 			tt = icaltime_from_timet_with_zone (convert_recurrence_minutes_to_timet (ei->OriginalStartDate), 0, 0);
 			rid.type = E_CAL_COMPONENT_RANGE_SINGLE;
 			rid.datetime.value = &tt;
-			rid.datetime.tzid = "UTC";
+			rid.datetime.tzid = recur_zone ? icaltimezone_get_tzid (recur_zone) : "UTC";
 			e_cal_component_set_recurid (detached[i], &rid);
 
 			tt = icaltime_from_timet_with_zone (convert_recurrence_minutes_to_timet (ei->StartDateTime), 0, 0);
 			edt.value = &tt;
-			edt.tzid = "UTC";
+			edt.tzid = recur_zone ? icaltimezone_get_tzid (recur_zone) : "UTC";
 			e_cal_component_set_dtstart (detached[i], &edt);
 
 			tt = icaltime_from_timet_with_zone (convert_recurrence_minutes_to_timet (ei->EndDateTime), 0, 0);
 			edt.value = &tt;
-			edt.tzid = "UTC";
+			edt.tzid = recur_zone ? icaltimezone_get_tzid (recur_zone) : "UTC";
 			e_cal_component_set_dtend (detached[i], &edt);
 
 			e_cal_component_set_rdate_list (detached[i], NULL);
diff --git a/src/libexchangemapi/exchange-mapi-cal-recur-utils.h b/src/libexchangemapi/exchange-mapi-cal-recur-utils.h
index faa26b4..6b95082 100644
--- a/src/libexchangemapi/exchange-mapi-cal-recur-utils.h
+++ b/src/libexchangemapi/exchange-mapi-cal-recur-utils.h
@@ -30,11 +30,9 @@
 
 G_BEGIN_DECLS
 
-gboolean
-exchange_mapi_cal_util_bin_to_rrule (GByteArray *ba, ECalComponent *comp, GSList **extra_detached);
+gboolean	exchange_mapi_cal_util_bin_to_rrule (GByteArray *ba, ECalComponent *comp, GSList **extra_detached, icaltimezone *recur_zone);
 
-GByteArray *
-exchange_mapi_cal_util_rrule_to_bin (ECalComponent *comp, GSList *modified_comps);
+GByteArray *	exchange_mapi_cal_util_rrule_to_bin (ECalComponent *comp, GSList *modified_comps);
 
 G_END_DECLS
 
diff --git a/src/libexchangemapi/exchange-mapi-cal-utils.c b/src/libexchangemapi/exchange-mapi-cal-utils.c
index 4005c92..6b7a9e8 100644
--- a/src/libexchangemapi/exchange-mapi-cal-utils.c
+++ b/src/libexchangemapi/exchange-mapi-cal-utils.c
@@ -949,7 +949,15 @@ exchange_mapi_cal_util_mapi_props_to_comp (ExchangeMapiConnection *conn, mapi_id
 		if (b && *b) {
 			stream = exchange_mapi_util_find_stream (streams, PidLidAppointmentRecur);
 			if (stream) {
-				exchange_mapi_cal_util_bin_to_rrule (stream->value, comp, detached_components);
+				icaltimezone *recur_zone;
+				const gchar *recur_tz_location;
+
+				recur_tz_location = exchange_mapi_util_find_array_namedid (properties, conn, fid, PidLidTimeZoneDescription);
+				if (recur_tz_location)
+					recur_tz_location = exchange_mapi_cal_tz_util_get_ical_equivalent (recur_tz_location);
+				recur_zone = recur_tz_location ? icaltimezone_get_builtin_timezone (recur_tz_location) : (icaltimezone *) default_zone;
+
+				exchange_mapi_cal_util_bin_to_rrule (stream->value, comp, detached_components, recur_zone);
 			}
 		}
 



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