\n");
+ /* If this is an all-day-event, set the end time to be identical to
+ * the start time (the hour/minute/second will be set to midnight).
+ * Otherwise extract or create it.
+ */
wprintf("
End
\n");
- p = icalcomponent_get_first_property(vevent, ICAL_DTEND_PROPERTY);
- if (p != NULL) {
- t = icalproperty_get_dtend(p);
+ if (t_start.is_date) {
+ t_end = t_start;
}
else {
- t = icaltime_from_timet(now, 0);
+ p = icalcomponent_get_first_property(vevent,
+ ICAL_DTEND_PROPERTY);
+ if (p != NULL) {
+ t_end = icalproperty_get_dtend(p);
+ }
+ else {
+ t_end = icaltime_from_timet(now, 0);
+ }
}
- display_icaltimetype_as_webform(&t, "dtend");
+ display_icaltimetype_as_webform(&t_end, "dtend");
wprintf("
\n");
wprintf("
Notes
\n"
@@ -200,11 +247,32 @@ void save_individual_event(icalcomponent *supplied_vevent, long msgnum) {
ICAL_DTSTART_PROPERTY), prop != NULL) {
icalcomponent_remove_property(vevent, prop);
}
- event_start = icaltime_from_webform("dtstart");
- if (event_start.is_date) {
- lprintf(9, "*** all day event ***\n");
+
+ if (!strcmp(bstr("alldayevent"), "yes")) {
all_day_event = 1;
+ lprintf(9, "*** all day event ***\n");
}
+ else {
+ all_day_event = 0;
+ }
+
+ event_start = icaltime_from_webform("dtstart");
+ if (all_day_event) {
+ event_start.is_date = 1;
+ event_start.hour = 0;
+ event_start.minute = 0;
+ event_start.second = 0;
+ }
+ lprintf(9, "dtstart: %s\n",
+ icaltime_as_ical_string(event_start)
+ );
+
+ /* FIXME. Somewhere between here and when we save the event, we are
+ * somehow losing the "is_date" setting of dtstart. The problem might
+ * be with WebCit or it might be in libical. Check to see if this
+ * problem goes away when we upgrade libical. --IG
+ */
+
icalcomponent_add_property(vevent,
icalproperty_new_dtstart(event_start)
);
@@ -217,10 +285,11 @@ void save_individual_event(icalcomponent *supplied_vevent, long msgnum) {
ICAL_DURATION_PROPERTY), prop != NULL) {
icalcomponent_remove_property(vevent, prop);
}
+
if (all_day_event == 0) {
icalcomponent_add_property(vevent,
- icalproperty_new_dtend(
- icaltime_from_webform("dtend")
+ icalproperty_new_dtend(icaltime_normalize(
+ icaltime_from_webform("dtend"))
)
);
}
@@ -233,7 +302,7 @@ void save_individual_event(icalcomponent *supplied_vevent, long msgnum) {
icalproperty_new_uid(buf)
);
}
-
+
/* Serialize it and save it to the message base */
serv_puts("ENT0 1|||4");
serv_gets(buf);