-// This file contains functions which handle all of the CalDAV "REPORT" queries
-// specified in RFC4791 section 7.
-//
+// This file contains functions which handle all of the CalDAV "REPORT" queries specified in RFC4791 section 7.
// Copyright (c) 2023-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.
+// This program is open source software. Use, duplication, or disclosure is subject to the GNU General Public License v3.
#include "webcit.h"
// XML parser callback
void caldav_xml_start(void *data, const char *el, const char **attr) {
struct cr_parms *crp = (struct cr_parms *) data;
- int i;
-
- // syslog(LOG_DEBUG, "CALDAV ELEMENT START: <%s> %d", el, crp->tag_nesting_level);
+#ifdef DEBUG_XML_PARSE
+ // logging
+ int i;
+ char indent[256];
+ indent[0] = 0;
+ for (i=0; i<crp->tag_nesting_level; ++i) {
+ strcat(indent, " ");
+ }
+ syslog(LOG_DEBUG, "%s<%s>", indent, el);
for (i = 0; attr[i] != NULL; i += 2) {
- syslog(LOG_DEBUG, " Attribute '%s' = '%s'", attr[i], attr[i + 1]);
+ syslog(LOG_DEBUG, "%sAttribute '%s' = '%s'", indent, attr[i], attr[i + 1]);
}
+ // end logging
+#endif
// RFC4791 7.8 "calendar-query" REPORT - Client will send a lot of search criteria.
if (!strcasecmp(el, "urn:ietf:params:xml:ns:caldav:calendar-query")) {
// XML parser callback
void caldav_xml_end(void *data, const char *el) {
struct cr_parms *crp = (struct cr_parms *) data;
+
--crp->tag_nesting_level;
+#ifdef DEBUG_XML_PARSE
+ // logging
+ int i;
+ char indent[256];
+ indent[0] = 0;
+ for (i=0; i<crp->tag_nesting_level; ++i) {
+ strcat(indent, " ");
+ }
if (crp->Chardata != NULL) {
- // syslog(LOG_DEBUG, "CALDAV CHARDATA : %s", ChrPtr(crp->Chardata));
+ syslog(LOG_DEBUG, "%sCHARDATA: '%s'", indent, ChrPtr(crp->Chardata));
}
- // syslog(LOG_DEBUG, "CALDAV ELEMENT END : <%s> %d", el, crp->tag_nesting_level);
+ syslog(LOG_DEBUG, "%s</%s>", indent, el);
+ // end logging
+#endif
if ((!strcasecmp(el, "DAV::href")) || (!strcasecmp(el, "DAV:href"))) {
if (crp->Hrefs == NULL) { // append crp->Chardata to crp->Hrefs