+
+ // We have a match. Drill down into the subcomponents.
+
+ icalcomponent *c = NULL;
+ int number_of_subcomponents = 0;
+ int number_of_matches = 0;
+ for ( c = icalcomponent_get_first_component(cal, ICAL_ANY_COMPONENT);
+ (c != 0);
+ c = icalcomponent_get_next_component(cal, ICAL_ANY_COMPONENT)
+ ) {
+ ++number_of_subcomponents;
+ if (caldav_apply_filters(c, filters, level+1)) {
+ syslog(LOG_DEBUG, "Subcomponent %d might match", number_of_subcomponents);
+ ++number_of_matches;
+ }
+ }
+ if (number_of_matches > 0) { // something matched
+ qual = 1;
+ }
+ else if (number_of_subcomponents > 0) { // nothing matched
+ return(0); // but only fail if there *were* subcomponents.
+ }
+
+ }
+ else {
+ syslog(LOG_DEBUG, "caldav: component at level %d is <%s>, looking for <%s>, rejecting",
+ start_at_level,
+ icalcomponent_kind_to_string(icalcomponent_isa(cal)),
+ t[3]
+ );