) {
char newfilter[SIZ];
int a = 0;
- int len = snprintf(newfilter, SIZ, &el[23]); // strip off "urn:ietf:params:xml:ns:caldav:" for our purposes
+ int len = snprintf(newfilter, SIZ, &el[30]); // strip off "urn:ietf:params:xml:ns:caldav:" for our purposes
while (attr[a]) {
len += snprintf(&newfilter[len], SIZ-len, "|%s", attr[a++]); // now save the attributes
}
array_append(crp->filters, newfilter);
- syslog(LOG_DEBUG, "%s", newfilter);
}
}
// Returns 1 if the calendar item DOES match the filter.
int caldav_apply_one_filter(void *cal, char *filter) {
syslog(LOG_DEBUG, "applying filter: %s", filter);
+
+ char this_filter[SIZ]; // we have to copy the filter string because we will destructively tokenize it
+ safestrncpy(this_filter, filter, sizeof(this_filter));
+
+ char *t[10] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL } ;
+ char *f = this_filter;
+ int num_tokens = 0;
+ while ( (t[num_tokens]=strtok_r(f, "|", &f)) && (num_tokens<10) ) {
+ ++num_tokens;
+ }
+
return(1);
}
void caldav_xml_end(void *, const char *);
void caldav_xml_chardata(void *, const XML_Char *, int);
StrBuf *fetch_ical(struct ctdlsession *, long);
+void cal_multiget_out(long, StrBuf *, StrBuf *, StrBuf *);
void caldav_report_one_item(struct http_transaction *, struct ctdlsession *, StrBuf *, StrBuf *);
+int caldav_apply_one_filter(void *, char *);
+int caldav_apply_filters(void *, Array *, int);
void caldav_report(struct http_transaction *, struct ctdlsession *);
// ctdlclient.c