253 } |
253 } |
254 } |
254 } |
255 return 1; |
255 return 1; |
256 } |
256 } |
257 |
257 |
|
258 SyncTagFilter* parse_tagfilter_string(const char* filterstring) { |
|
259 if (!filterstring) { |
|
260 return NULL; |
|
261 } |
|
262 |
|
263 SyncTagFilter* tagfilter = malloc(sizeof(SyncTagFilter)); |
|
264 tagfilter->mode = DAV_SYNC_TAGFILTER_AND; |
|
265 tagfilter->subfilter_count = 0; |
|
266 tagfilter->tags = parse_csv_taglist(filterstring, strlen(filterstring)); |
|
267 |
|
268 return tagfilter; |
|
269 } |
|
270 |
258 static int matches_tags_and(UcxList *dav_tags, UcxList *tags, int ignorecase) { |
271 static int matches_tags_and(UcxList *dav_tags, UcxList *tags, int ignorecase) { |
259 UCX_FOREACH(e, tags) { |
272 UCX_FOREACH(e, tags) { |
260 if (!ucx_list_contains(dav_tags, e->data, |
273 if (!ucx_list_contains(dav_tags, e->data, |
261 (cmp_func) compare_tagname, &ignorecase)) { |
274 (cmp_func) compare_tagname, &ignorecase)) { |
262 return 0; |
275 return 0; |
517 if (res_matches_filter(dir, res->path)) { |
530 if (res_matches_filter(dir, res->path)) { |
518 res = res->next; |
531 res = res->next; |
519 continue; |
532 continue; |
520 } |
533 } |
521 |
534 |
522 // TODO: remove this fake and let the cmd parser store the filter |
535 if (!res_matches_tags(res, |
523 SyncTagFilter tagfilter; |
536 parse_tagfilter_string(cmd_getoption(a, "tags")))) { |
524 tagfilter.mode = DAV_SYNC_TAGFILTER_AND; |
|
525 tagfilter.subfilter_count = 0; |
|
526 tagfilter.tags = NULL; |
|
527 char *tags_str = cmd_getoption(a, "tags"); |
|
528 if(tags_str) { |
|
529 tagfilter.tags = parse_csv_taglist(tags_str, strlen(tags_str)); |
|
530 } |
|
531 if (!res_matches_tags(res, &tagfilter)) { |
|
532 if(!cmd_getoption(a, "remove")) { |
537 if(!cmd_getoption(a, "remove")) { |
533 localres_keep(db, res->path); |
538 localres_keep(db, res->path); |
534 } |
539 } |
535 res = res->next; |
540 res = res->next; |
536 continue; |
541 continue; |