401:3bb3210f3e6e | 402:babdf40dd22c |
---|---|
256 } | 256 } |
257 return 1; | 257 return 1; |
258 } | 258 } |
259 | 259 |
260 static int res_matches_tags(DavResource *res, SyncTagFilter *tagfilter) { | 260 static int res_matches_tags(DavResource *res, SyncTagFilter *tagfilter) { |
261 if(!tagfilter) { | |
262 return 1; | |
263 } | |
264 | |
261 if(tagfilter->mode == DAV_SYNC_TAGFILTER_OFF) { | 265 if(tagfilter->mode == DAV_SYNC_TAGFILTER_OFF) { |
262 return 1; | 266 return 1; |
263 } | 267 } |
264 | 268 |
265 DavXmlNode *tagsprop = dav_get_property_ns(res, DAV_NS, "tags"); | 269 DavXmlNode *tagsprop = dav_get_property_ns(res, DAV_NS, "tags"); |
439 } | 443 } |
440 | 444 |
441 return -1; | 445 return -1; |
442 } | 446 } |
443 | 447 |
448 DavBool remove_file = cmd_getoption(a, "remove") ? 1 : 0; | |
449 | |
444 int sync_success = 0; | 450 int sync_success = 0; |
445 int sync_delete = 0; | 451 int sync_delete = 0; |
446 int sync_error = 0; | 452 int sync_error = 0; |
447 | 453 |
448 UcxMap *svrres = ucx_map_new(db->resources->count); | 454 UcxMap *svrres = ucx_map_new(db->resources->count); |
453 while(stack) { | 459 while(stack) { |
454 DavResource *res = stack->data; | 460 DavResource *res = stack->data; |
455 stack = ucx_list_remove(stack, stack); | 461 stack = ucx_list_remove(stack, stack); |
456 | 462 |
457 while(res) { | 463 while(res) { |
458 if (res_matches_filter(dir, res->path)) { | 464 if ( res_matches_filter(dir, res->path) |
465 || !res_matches_tags(res, dir->tagfilter)) | |
466 { | |
467 // don't delete files filtered by config | |
468 localres_keep(db, res->path); | |
459 res = res->next; | 469 res = res->next; |
460 continue; | 470 continue; |
461 } | 471 } |
462 | 472 |
463 if (!res_matches_tags(res, tagfilter)) { | 473 if (!res_matches_tags(res, tagfilter)) { |
464 if(!cmd_getoption(a, "remove")) { | 474 if(!remove_file) { |
465 localres_keep(db, res->path); | 475 localres_keep(db, res->path); |
466 } | 476 } |
467 res = res->next; | 477 res = res->next; |
468 continue; | 478 continue; |
469 } | 479 } |