From cf62d75a721b553e35bcbcc040dde194d69b87be Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Thu, 21 Mar 2024 11:50:21 -0700 Subject: [PATCH] ical_ctdl_is_overlap.c: cleaned it up --- .../server/modules/calendar/ical_ctdl_is_overlap.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/citadel/server/modules/calendar/ical_ctdl_is_overlap.c b/citadel/server/modules/calendar/ical_ctdl_is_overlap.c index fbec0f572..30a0b166d 100644 --- a/citadel/server/modules/calendar/ical_ctdl_is_overlap.c +++ b/citadel/server/modules/calendar/ical_ctdl_is_overlap.c @@ -26,13 +26,9 @@ int ical_ctdl_is_overlap( } else { if (t1end.is_date && icaltime_compare(t1start, t1end)) { - - // The end date is non-inclusive so adjust it by one - // day because our test is inclusive, note that a day is - // not too much because we are talking about all day events. - // - // If start = end we assume that nevertheless the whole day is meant. - + // The end date is non-inclusive so adjust it by one day because our test is inclusive. + // Note that a day is not too much because we are talking about all day events. + // If start==end we assume that it means one day. icaltime_adjust(&t1end, -1, 0, 0, 0); } } @@ -46,7 +42,6 @@ int ical_ctdl_is_overlap( ); #endif - if (icaltime_is_null_time(t2end)) { memcpy(&t2end, &t2start, sizeof(struct icaltimetype)); } @@ -69,14 +64,13 @@ int ical_ctdl_is_overlap( } // Now check for overlaps using date *and* time. + // We could probably implement this in terms of icaltime_span_overlaps() but this does the same thing. // If event 1 ends before event 2 starts, there is no match. if (icaltime_compare(t1end, t2start) <= 0) return(0); - // syslog(LOG_DEBUG, "calendar: first passed"); // If event 2 ends before event 1 starts, there is no match. if (icaltime_compare(t2end, t1start) <= 0) return(0); - // syslog(LOG_DEBUG, "calendar: second passed"); // Otherwise, there is an overlap, so yes we have a match. return(1); -- 2.30.2