+ else {
+ if (icaltime_compare(dtstart, icalcomponent_get_dtstart(fb)) < 0) {
+ icalcomponent_set_dtstart(fb, dtstart);
+ }
+ }
+
+ /* Make sure the DTEND property of the freebusy *list* is set to
+ * the DTEND property of the *latest event*.
+ */
+ p = icalcomponent_get_first_property(fb, ICAL_DTEND_PROPERTY);
+ if (p == NULL) {
+ icalcomponent_set_dtend(fb, dtend);
+ }
+ else {
+ if (icaltime_compare(dtend, icalcomponent_get_dtend(fb)) > 0) {
+ icalcomponent_set_dtend(fb, dtend);
+ }
+ }
+
+ if (rrule) {
+ dtstart = icalrecur_iterator_next(ritr);
+ if (!icaltime_is_null_time(dtend)) {
+ dtend = icaltime_add(dtstart, dur);
+ }
+ ++num_recur;
+ }
+
+ } while ( (rrule) && (!icaltime_is_null_time(dtstart)) && (num_recur < MAX_RECUR) ) ;
+ icalrecur_iterator_free(ritr);