- /* FIXME : attach any needed timezones here */
- icalcomponent_foreach_tzid(c, ical_putics_grabtzids, NULL);
+ /* Attach any needed timezones here */
+ tzidlist = NewHash(1, NULL);
+ if (tzidlist) {
+ icalcomponent_foreach_tzid(c, ical_putics_grabtzids, tzidlist);
+ }
+ HashPos = GetNewHashPos(tzidlist, 0);
+
+ while (GetNextHashPos(tzidlist, HashPos, &len, &Key, &Value)) {
+ CtdlLogPrintf(CTDL_DEBUG, "Attaching timezone '%s'\n", Value);
+ icaltimezone *t = NULL;
+
+ /* First look for a timezone attached to the original calendar */
+ t = icalcomponent_get_timezone(cal, Value);
+
+ /* Try built-in tzdata if the right one wasn't attached */
+ if (!t) {
+ t = icaltimezone_get_builtin_timezone(Value);
+ }
+
+ /* I've got a valid timezone to attach. */
+ if (t) {
+ icalcomponent_add_component(encaps,
+ icalcomponent_new_clone(
+ icaltimezone_get_component(t)
+ )
+ );
+ }
+
+ }
+ DeleteHashPos(&HashPos);
+ DeleteHash(&tzidlist);