{
icalproperty *ps = NULL;
struct icaltimetype dtstart, dtend;
+ struct icaldurationtype dur;
struct wcsession *WCC = WC;
disp_cal *Cal;
size_t len;
if (WCC->disp_cal_items == NULL)
WCC->disp_cal_items = NewHash(0, Flathash);
-
+
+
+
+ /* Note: anything we do here, we also have to do below for the recurrences. */
Cal = (disp_cal*) malloc(sizeof(disp_cal));
memset(Cal, 0, sizeof(disp_cal));
if (icaltime_is_null_time(dtstart)) return; /* Can't recur without a start time */
+ if (!icaltime_is_null_time(dtend)) { /* Need duration for recurrences */
+ dur = icaltime_subtract(dtend, dtstart);
+ }
+
/*
* Just let libical iterate the recurrence, and keep looping back to the top of this function,
* adding new hash entries that all point back to the same msgnum, until either the iteration
while (next = icalrecur_iterator_next(ritr), !icaltime_is_null_time(next) ) {
++num_recur;
- lprintf(9, "* Doing a recurrence %d\n", num_recur);
- /* FIXME this is unfinished */
+
+ /* Note: anything we do here, we also have to do above for the root event. */
+ Cal = (disp_cal*) malloc(sizeof(disp_cal));
+ memset(Cal, 0, sizeof(disp_cal));
+
+ Cal->cal = icalcomponent_new_clone(cal);
+ Cal->unread = unread;
+ len = strlen(from);
+ Cal->from = (char*)malloc(len+ 1);
+ memcpy(Cal->from, from, len + 1);
+ ical_dezonify(Cal->cal);
+ Cal->cal_msgnum = msgnum;
+
+ ps = icalcomponent_get_first_property(Cal->cal, ICAL_DTSTART_PROPERTY);
+ if (ps != NULL) {
+ icalcomponent_remove_property(Cal->cal, ps);
+ ps = icalproperty_new_dtstart(next);
+ icalcomponent_add_property(Cal->cal, ps);
+ Cal->event_start = icaltime_as_timet(next);
+ }
+
+ ps = icalcomponent_get_first_property(Cal->cal, ICAL_DTEND_PROPERTY);
+ if (ps != NULL) {
+ icalcomponent_remove_property(Cal->cal, ps);
+ /* FIXME now set the dtend property and stuff it somewhere */
+ }
+
+ Put(WCC->disp_cal_items,
+ (char*) &Cal->event_start,
+ sizeof(Cal->event_start),
+ Cal,
+ delete_cal);
}
+ time_t tt = icaltime_as_timet(next);
+ lprintf(9, "Performed %d recurrences; final one is %s", num_recur, ctime(&tt));
#endif /* TECH_PREVIEW */