+/*
+ * Phase 6 of "hunt for conflicts"
+ * called by ical_conflicts_phase5()
+ *
+ * Now both the proposed and existing events have been boiled down to start and end times.
+ * Check for overlap and output any conflicts.
+ *
+ * Returns nonzero if a conflict was reported. This allows the caller to stop iterating.
+ */
+int ical_conflicts_phase6(struct icaltimetype t1start,
+ struct icaltimetype t1end,
+ struct icaltimetype t2start,
+ struct icaltimetype t2end,
+ long existing_msgnum,
+ char *conflict_event_uid,
+ char *conflict_event_summary,
+ char *compare_uid)
+{
+ int conflict_reported = 0;
+
+ /* debugging cruft *
+ time_t tt;
+ tt = icaltime_as_timet_with_zone(t1start, t1start.zone);
+ CtdlLogPrintf(CTDL_DEBUG, "PROPOSED START: %s", ctime(&tt));
+ tt = icaltime_as_timet_with_zone(t1end, t1end.zone);
+ CtdlLogPrintf(CTDL_DEBUG, " PROPOSED END: %s", ctime(&tt));
+ tt = icaltime_as_timet_with_zone(t2start, t2start.zone);
+ CtdlLogPrintf(CTDL_DEBUG, "EXISTING START: %s", ctime(&tt));
+ tt = icaltime_as_timet_with_zone(t2end, t2end.zone);
+ CtdlLogPrintf(CTDL_DEBUG, " EXISTING END: %s", ctime(&tt));
+ * debugging cruft */
+
+ /* compare and output */
+
+ if (ical_ctdl_is_overlap(t1start, t1end, t2start, t2end)) {
+ cprintf("%ld||%s|%s|%d|\n",
+ existing_msgnum,
+ conflict_event_uid,
+ conflict_event_summary,
+ ( ((strlen(compare_uid)>0)
+ &&(!strcasecmp(compare_uid,
+ conflict_event_uid))) ? 1 : 0
+ )
+ );
+ conflict_reported = 1;
+ }
+
+ return(conflict_reported);
+}
+