dtstart = dtend = icaltime_null_time();
- calcomp = icalcomponent_new_vcalendar();
- icalcomponent_set_method(calcomp, ICAL_METHOD_PUBLISH);
- prop = icalproperty_new_version("2.0");
- icalcomponent_add_property(calcomp, prop);
- if (parent_zone)
+ if (parent_zone) {
+ calcomp = NULL;
icaltz = parent_zone;
- else {
+ } else {
+ calcomp = icalcomponent_new_vcalendar();
+ icalcomponent_set_method(calcomp, ICAL_METHOD_PUBLISH);
+ prop = icalproperty_new_version("2.0");
+ icalcomponent_add_property(calcomp, prop);
+
icaltz = get_meeting_timezone(xml_node, error);
if (icaltz)
freetz = TRUE;
- else {
+ else
icaltz = get_timezone(xml_node, error);
- if (icaltz) {
- icalcomponent *comp = icaltimezone_get_component(icaltz);
- icalcomponent_add_component(calcomp, comp);
- }
+
+ if (icaltz) {
+ icalcomponent *comp = icaltimezone_get_component(icaltz);
+ icalcomponent_add_component(calcomp, comp);
}
}
}
free(deletia);
}
- icalcomponent_add_component(calcomp, comp);
+ if (calcomp) {
+ icalcomponent_add_component(calcomp, comp);
- if (modifia) {
- const char *uid = icalcomponent_get_uid(comp);
-
- for (i = 0; i < modifia_count; i++) {
- printf("Modified: %s\n", modifia[i]);
- if (fetch_subitem) {
- comp = fetch_subitem(fetch_subitem_priv, modifia[i], uid, icaltz, error);
- if (!comp)
- goto err;
+ if (modifia) {
+ const char *uid = icalcomponent_get_uid(comp);
+
+ for (i = 0; i < modifia_count; i++) {
+ if (fetch_subitem) {
+ comp = fetch_subitem(fetch_subitem_priv, modifia[i], uid, icaltz, error);
+ if (!comp)
+ goto err;
+ icalcomponent_add_component(calcomp, comp);
+ }
}
+ free(modifia);
}
- free(modifia);
}
if (freetz)
icaltimezone_free(icaltz, 1);
- return calcomp;
+
+ return calcomp?:comp;
err:
- icalcomponent_free(calcomp);
+ if (comp)
+ icalcomponent_free(comp);
+ if (calcomp)
+ icalcomponent_free(calcomp);
if (deletia)
free(deletia);
+ if (modifia)
+ free(modifia);
+
return NULL;
}
gboolean process_orig_start(icalcomponent *comp, xmlNode *xml_node, icaltimezone *icaltz, GError **error)
{
+ icalproperty *prop;
+ const char *tzid = NULL;
icaltimetype t;
if (!process_time(comp, xml_node, &t, error))
return FALSE;
- if (icaltz)
+ if (icaltz) {
t = icaltime_convert_to_zone(t, icaltz);
- icalcomponent_set_recurrenceid(comp, t);
+ }
+
+ /* Grr, icalproperty_add_recurrenceid() doesn't include TZID */
+ prop = icalproperty_new_recurrenceid(t);
+ tzid = icaltime_get_tzid(t);
+ if (tzid)
+ icalproperty_add_parameter(prop, icalparameter_new_tzid(tzid));
+ icalcomponent_add_property(comp, prop);
return TRUE;
}