+
+ /* Non-VTIMEZONE components each get written as individual messages.
+ * But we also need to attach the relevant VTIMEZONE components to them.
+ */
+ if ( (icalcomponent_isa(c) != ICAL_VTIMEZONE_COMPONENT)
+ && (encaps = icalcomponent_new_vcalendar()) ) {
+ icalcomponent_add_property(encaps, icalproperty_new_prodid(PRODID));
+ icalcomponent_add_property(encaps, icalproperty_new_version("2.0"));
+ icalcomponent_set_method(encaps, ICAL_METHOD_PUBLISH);
+
+ /* Attach any needed timezones here */
+ char need_these_tzids[1024] = "";
+ icalcomponent_foreach_tzid(c, ical_putics_grabtzids, need_these_tzids);
+ for (i=0; i<num_tokens(need_these_tzids, '\n'); ++i) {
+ CtdlLogPrintf(CTDL_DEBUG, "FIXME need to attach a tzid\n");
+ }
+
+ /* Now attach the component itself (usually a VEVENT or VTODO) */
+ icalcomponent_add_component(encaps, icalcomponent_new_clone(c));
+
+ /* Write it to the message store */
+ ical_write_to_cal(NULL, encaps);
+ icalcomponent_free(encaps);
+ }