From: Art Cancro Date: Fri, 19 Dec 2008 04:05:49 +0000 (+0000) Subject: * ICAL 'getics' mode (which is used for downloading the X-Git-Tag: v7.86~1695 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=64cbe29f025f7e432540e6cede04749e033144cd * ICAL 'getics' mode (which is used for downloading the entire calendar, e.g. when doing a WebCal fetch) now suppresses duplicate VTIMEZONE components which carry the same TZID. --- diff --git a/citadel/modules/calendar/serv_calendar.c b/citadel/modules/calendar/serv_calendar.c index 247d17740..97d1506ea 100644 --- a/citadel/modules/calendar/serv_calendar.c +++ b/citadel/modules/calendar/serv_calendar.c @@ -1497,7 +1497,24 @@ void ical_getics_backend(long msgnum, void *data) { for (c = icalcomponent_get_first_component(ird.cal, ICAL_ANY_COMPONENT); (c != NULL); c = icalcomponent_get_next_component(ird.cal, ICAL_ANY_COMPONENT)) { - icalcomponent_add_component(encaps, icalcomponent_new_clone(c)); + + /* For VTIMEZONE components, suppress duplicates of the same tzid */ + + if (icalcomponent_isa(c) == ICAL_VTIMEZONE_COMPONENT) { + icalproperty *p = icalcomponent_get_first_property(c, ICAL_TZID_PROPERTY); + if (p) { + const char *tzid = icalproperty_get_tzid(p); + if (!icalcomponent_get_timezone(encaps, tzid)) { + icalcomponent_add_component(encaps, + icalcomponent_new_clone(c)); + } + } + } + + /* All other types of components can go in verbatim */ + else { + icalcomponent_add_component(encaps, icalcomponent_new_clone(c)); + } } icalcomponent_free(ird.cal); }