// As we slog our way through the XML we learn what the client is asking for
// and build up the contents of this data type.
struct cr_params {
- int tag_nesting_level; // not needed, just kept for pretty-printing
+ int comp_filter_nesting_level;
enum cr_type report_type; // which RFC4791 section 7 REPORT are we generating
StrBuf *Chardata; // XML chardata in between tags is built up here
StrBuf *Hrefs; // list of items requested by a `calendar-multiget` REPORT
#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);
-#endif
- ++crp->tag_nesting_level;
-#ifdef DEBUG_XML_PARSE
- indent[0] = 0;
- for (i=0; i<crp->tag_nesting_level; ++i) {
- strcat(indent, " ");
- }
- for (i = 0; attr[i] != NULL; i += 2) {
- syslog(LOG_DEBUG, "%sAttribute '%s' = '%s'", indent, attr[i], attr[i + 1]);
+ syslog(LOG_DEBUG, "<%s>", el);
+ for (int i = 0; attr[i] != NULL; i += 2) {
+ syslog(LOG_DEBUG, "Attribute '%s' = '%s'", attr[i], attr[i + 1]);
}
// end logging
#endif
// RFC4791 9.7 create a filter array if this query contains a "filter" stanza
else if (!strcasecmp(el, CAL"filter")) {
crp->filters = array_new(SIZ);
- crp->filter_nest = crp->tag_nesting_level;
+ crp->filter_nest = crp->comp_filter_nesting_level;
}
// Handle the filters defined in RFC4791 9.7.1 through 9.7.5
&& (crp->filters) // Make sure we actually allocated an array
) {
+ if (!strcasecmp(el, CAL"comp-filter")) {
+ ++crp->comp_filter_nesting_level;
+ }
+
char newfilter[SIZ];
int a = 0;
- int len = snprintf(newfilter, SIZ, "%d|", crp->tag_nesting_level - crp->filter_nest - 1);
+ int len = snprintf(newfilter, SIZ, "%d|", crp->comp_filter_nesting_level - crp->filter_nest - 1);
len += snprintf(&newfilter[len], SIZ-len, "%s", &el[CALLEN]); // filter name without the namespace
while (attr[a]) {
len += snprintf(&newfilter[len], SIZ-len, "|%s", attr[a++]); // now save the attributes
void caldav_xml_end(void *data, const char *el) {
struct cr_params *crp = (struct cr_params *) 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, " ");
- }
- syslog(LOG_DEBUG, "%s</%s>", indent, el);
+ syslog(LOG_DEBUG, "</%s>", el);
// end logging
#endif
+ if (!strcasecmp(el, CAL"comp-filter")) {
+ --crp->comp_filter_nesting_level;
+ }
+
+
if ((!strcasecmp(el, "DAV::href")) || (!strcasecmp(el, "DAV:href"))) {
if (crp->Hrefs == NULL) { // append crp->Chardata to crp->Hrefs
crp->Hrefs = NewStrBuf();
string_trim(app); // remove leading/trailing whitespace. ok to mangle it because we've already appended.
if (!IsEmptyStr(app)) {
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, app, len);
+ syslog(LOG_DEBUG, "%s", app, len);
}
// end logging
#endif