From: Art Cancro Date: Tue, 27 Feb 2024 16:16:56 +0000 (-0500) Subject: Skeleton code for time-range test (section 9.9) X-Git-Tag: v999~31 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=29d91a0edee2565fd59b5b5a20963e73d528a5cf Skeleton code for time-range test (section 9.9) After finally getting to the point where we are recursing up through both the nested components and the nested queries in a way that matches them properly, we are now able to start writing the individual property and parameter queries defined in the RFC. time-range (section 9.9) is the obvious first choice to implement because it is the most useful. Wrote and bound the skeleton function to do this. --- diff --git a/webcit-ng/server/caldav_reports.c b/webcit-ng/server/caldav_reports.c index 08972cb86..eac1e7e38 100644 --- a/webcit-ng/server/caldav_reports.c +++ b/webcit-ng/server/caldav_reports.c @@ -257,6 +257,21 @@ 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 *cal, char *start, char *end) { + + TRACE; + syslog(LOG_DEBUG, "Does this %s fall between %s and %s ?", + icalcomponent_kind_to_string(icalcomponent_isa(cal)), + start, + end + ); + + return(1); +} + + // Recursive function to apply CalDAV FILTERS to a calendar item. // Returns zero if the calendar item was disqualified by a filter, nonzero if the calendar item still qualifies. int caldav_apply_filters(void *cal, Array *filters, int apply_at_level) { @@ -371,10 +386,24 @@ int caldav_apply_filters(void *cal, Array *filters, int apply_at_level) { syslog(LOG_DEBUG, "text match filter at level %d FIXME not implemented yet", this_rule_level); } - else if (!strcasecmp(t[1], "time-range")) { + else if (!strcasecmp(t[1], "time-range")) { // RFC4791 9.9 syslog(LOG_DEBUG, "time range filter at level %d FIXME not implemented yet", this_rule_level); - for (int i=0; i", i, t[i]); + for (int i=2; (i+1)