ical_ctdl_is_overlap.c: cleaned it up
authorArt Cancro <ajc@citadel.org>
Thu, 21 Mar 2024 18:50:21 +0000 (11:50 -0700)
committerArt Cancro <ajc@citadel.org>
Thu, 21 Mar 2024 18:50:21 +0000 (11:50 -0700)
citadel/server/modules/calendar/ical_ctdl_is_overlap.c

index fbec0f572163919011f8da30e48428da83c837a1..30a0b166d5eabfdcfb9e87bab8ee38bab3e789dd 100644 (file)
@@ -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);