From fc3a564c7bba86a29503b39bdd8512801116e70e Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Thu, 21 Mar 2024 11:54:37 -0400 Subject: [PATCH] Changed "supplied_xxx" to "xxx_in" when we modify. --- .../modules/calendar/ical_ctdl_is_overlap.c | 18 +++++++++++------- webcit-ng/Makefile | 2 +- webcit-ng/server/caldav_reports.c | 18 ++++++++++++++++-- webcit-ng/server/html2html.c | 6 +++--- webcit-ng/server/text2html.c | 2 +- webcit-ng/server/webcit.h | 1 - 6 files changed, 32 insertions(+), 15 deletions(-) diff --git a/citadel/server/modules/calendar/ical_ctdl_is_overlap.c b/citadel/server/modules/calendar/ical_ctdl_is_overlap.c index 6902fd04d..d980c554b 100644 --- a/citadel/server/modules/calendar/ical_ctdl_is_overlap.c +++ b/citadel/server/modules/calendar/ical_ctdl_is_overlap.c @@ -8,6 +8,7 @@ #include #include +#include // Check to see if two events overlap. Returns nonzero if they do. int ical_ctdl_is_overlap( @@ -36,6 +37,16 @@ int ical_ctdl_is_overlap( } } +#ifdef DEBUG_ICAL_OVERLAP + syslog(LOG_DEBUG, "Comparing t1start=%s,t1end=%s to t2start=%s,t2end=%s", + icaltime_as_ical_string_r(t1start), + icaltime_as_ical_string_r(t1end), + icaltime_as_ical_string_r(t2start), + icaltime_as_ical_string_r(t2end) + ); +#endif + + if (icaltime_is_null_time(t2end)) { memcpy(&t2end, &t2start, sizeof(struct icaltimetype)); } @@ -57,13 +68,6 @@ int ical_ctdl_is_overlap( return(1); } -#ifdef DEBUG_ICAL_OVERLAP - syslog(LOG_DEBUG, "Comparing t1start %d:%d t1end %d:%d t2start %d:%d t2end %d:%d", - t1start.hour, t1start.minute, t1end.hour, t1end.minute, - t2start.hour, t2start.minute, t2end.hour, t2end.minute - ); -#endif - // Now check for overlaps using date *and* time. // If event 1 ends before event 2 starts, there is no match. diff --git a/webcit-ng/Makefile b/webcit-ng/Makefile index 291a9a888..9e00b7f8d 100644 --- a/webcit-ng/Makefile +++ b/webcit-ng/Makefile @@ -3,7 +3,7 @@ # This program is open source software. Use, duplication, or # disclosure are subject to the GNU General Public License v3. -CFLAGS := $(CFLAGS) -ggdb -Wno-format-truncation +CFLAGS := $(CFLAGS) -ggdb -Wno-format-truncation -DDEBUG_ICAL_OVERLAP LDFLAGS := $(LDFLAGS) SRC := server diff --git a/webcit-ng/server/caldav_reports.c b/webcit-ng/server/caldav_reports.c index 758a4a2f1..188f4bd19 100644 --- a/webcit-ng/server/caldav_reports.c +++ b/webcit-ng/server/caldav_reports.c @@ -259,13 +259,27 @@ void caldav_report_one_item(struct http_transaction *h, struct ctdlsession *c, S // Compare function for "time-range" tests (RFC4791 section 9.9) // Returns nonzero if the supplied icalcomponent occurs within the specified time range -int caldav_time_range_filter_matches(icalcomponent *supplied_cal, char *start_str, char *end_str) { +int caldav_time_range_filter_matches(icalcomponent *cal_in, char *start_str, char *end_str) { struct icaltimetype start = (start_str ? icaltime_from_string(start_str) : icaltime_null_time()); struct icaltimetype end = (end_str ? icaltime_from_string(end_str) : icaltime_null_time()); + + + + +// NOTE TO ME: The header file says +// "This converts both times to the UTC timezone and compares them." +// LIBICAL_ICAL_EXPORT int icaltime_compare(const struct icaltimetype a, const struct icaltimetype b); +// How does it do that without knowing the time zone? Does it use a private method to look up into the +// parent component to find a VTIMEZONE component? Find out. If it can do that, we don't have to dezonify. + + + + + // make a local copy of the component because we are going to modify it by converting times to UTC - icalcomponent *cal = icalcomponent_new_clone(supplied_cal); + icalcomponent *cal = icalcomponent_new_clone(cal_in); ical_dezonify(cal); syslog(LOG_DEBUG, "\033[7mcaldav_time_range_filter_matches()\033[0m : Does this %s fall between %s and %s ?", diff --git a/webcit-ng/server/html2html.c b/webcit-ng/server/html2html.c index d99877c89..8f0b4659d 100644 --- a/webcit-ng/server/html2html.c +++ b/webcit-ng/server/html2html.c @@ -1,7 +1,7 @@ // Output an HTML message, modifying it slightly to make sure it plays nice // with the rest of our web framework. // -// Copyright (c) 2005-2022 by the citadel.org team +// Copyright (c) 2005-2024 by the citadel.org team // // This program is open source software. Use, duplication, or disclosure is subject to the GNU General Public License v3. @@ -82,7 +82,7 @@ void extract_charset_from_meta(char *charset, char *meta_http_equiv, char *meta_ // Sanitize and enhance an HTML message for display. // Also convert weird character sets to UTF-8 if necessary. // Also fixup img src="cid:..." type inline images to fetch the image -StrBuf *html2html(const char *supplied_charset, int treat_as_wiki, char *roomname, long msgnum, StrBuf *Source) { +StrBuf *html2html(const char *charset_in, int treat_as_wiki, char *roomname, long msgnum, StrBuf *Source) { char buf[SIZ]; char *msg; char *ptr; @@ -114,7 +114,7 @@ StrBuf *html2html(const char *supplied_charset, int treat_as_wiki, char *roomnam return (NULL); } - safestrncpy(charset, supplied_charset, sizeof charset); + safestrncpy(charset, charset_in, sizeof charset); sprintf(new_window, "