[evolution-ews] Bug 784332 - EXDATE missed in recurring events



commit a10411526316efa79ca49c9860e443fe3e97376c
Author: Milan Crha <mcrha redhat com>
Date:   Thu Jun 29 14:09:56 2017 +0200

    Bug 784332 - EXDATE missed in recurring events

 src/calendar/e-cal-backend-ews.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/src/calendar/e-cal-backend-ews.c b/src/calendar/e-cal-backend-ews.c
index 7adac7b..3fe7e0b 100644
--- a/src/calendar/e-cal-backend-ews.c
+++ b/src/calendar/e-cal-backend-ews.c
@@ -652,6 +652,7 @@ ecb_ews_item_to_component_sync (ECalBackendEws *cbews,
        icalcomp = icalcomponent_get_first_component (vcomp, kind);
        if (icalcomp) {
                icalproperty *icalprop, *freebusy;
+               struct icaltimetype itt;
                const EwsId *item_id;
                const GSList *l = NULL;
                const gchar *uid = e_ews_item_get_uid (item);
@@ -757,6 +758,22 @@ ecb_ews_item_to_component_sync (ECalBackendEws *cbews,
                        }
                }
 
+               /* The EXDATE sent by the server can be date-time format with timezone, while
+                  the event start time can be date-only. This breaks the rules, thus correct
+                  it and make also EXDATE date-only. */
+               itt = icalcomponent_get_dtstart (icalcomp);
+               if (icaltime_is_valid_time (itt) && itt.is_date) {
+                       for (icalprop = icalcomponent_get_first_property (icalcomp, ICAL_EXDATE_PROPERTY);
+                            icalprop;
+                            icalprop = icalcomponent_get_next_property (icalcomp, ICAL_EXDATE_PROPERTY)) {
+                               itt = icalproperty_get_exdate (icalprop);
+                               itt.is_date = 1;
+                               icalproperty_set_exdate (icalprop, itt);
+
+                               icalproperty_remove_parameter_by_kind (icalprop, ICAL_TZID_PARAMETER);
+                       }
+               }
+
                /* Exchange sets an ORGANIZER on all events. RFC2445 says:
                 *
                 *   This property MUST NOT be specified in an iCalendar


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