457 static void localres_keep(SyncDatabase *db, const char *path) { |
457 static void localres_keep(SyncDatabase *db, const char *path) { |
458 LocalResource *local = ucx_map_cstr_remove(db->resources, path); |
458 LocalResource *local = ucx_map_cstr_remove(db->resources, path); |
459 if(local) { |
459 if(local) { |
460 local->keep = TRUE; |
460 local->keep = TRUE; |
461 } |
461 } |
462 |
462 } |
|
463 |
|
464 static int xattr_filter(const char *name, SyncDirectory *dir) { |
|
465 // exclude tag xattr |
|
466 if( |
|
467 dir->tagconfig && |
|
468 dir->tagconfig->store == TAG_STORE_XATTR && |
|
469 !strcmp(dir->tagconfig->xattr_name, name)) |
|
470 { |
|
471 return 0; |
|
472 } |
|
473 return 1; |
463 } |
474 } |
464 |
475 |
465 void res2map(DavResource *root, UcxMap *map) { |
476 void res2map(DavResource *root, UcxMap *map) { |
466 UcxList *stack = ucx_list_prepend(NULL, root->children); |
477 UcxList *stack = ucx_list_prepend(NULL, root->children); |
467 while(stack) { |
478 while(stack) { |
2729 } |
2740 } |
2730 } |
2741 } |
2731 |
2742 |
2732 if((dir->metadata & FINFO_XATTR) == FINFO_XATTR) { |
2743 if((dir->metadata & FINFO_XATTR) == FINFO_XATTR) { |
2733 char *path = create_local_path(dir, local_resource_path(db_res)); |
2744 char *path = create_local_path(dir, local_resource_path(db_res)); |
2734 XAttributes *xattr = file_get_attributes(path); |
2745 XAttributes *xattr = file_get_attributes(path, (xattr_filter_func)xattr_filter, dir); |
2735 // test if xattr are added, removed or changed |
2746 // test if xattr are added, removed or changed |
2736 if((db_res->xattr_hash && !xattr) || |
2747 if((db_res->xattr_hash && !xattr) || |
2737 (!db_res->xattr_hash && xattr) || |
2748 (!db_res->xattr_hash && xattr) || |
2738 (xattr && db_res->xattr_hash && strcmp(xattr->hash, db_res->xattr_hash))) |
2749 (xattr && db_res->xattr_hash && strcmp(xattr->hash, db_res->xattr_hash))) |
2739 { |
2750 { |
2823 |
2834 |
2824 int local_resource_load_metadata(SyncDirectory *dir, LocalResource *res) { |
2835 int local_resource_load_metadata(SyncDirectory *dir, LocalResource *res) { |
2825 // currently only xattr needed |
2836 // currently only xattr needed |
2826 if((dir->metadata & FINFO_XATTR) == FINFO_XATTR) { |
2837 if((dir->metadata & FINFO_XATTR) == FINFO_XATTR) { |
2827 char *path = create_local_path(dir, local_resource_path(res)); |
2838 char *path = create_local_path(dir, local_resource_path(res)); |
2828 XAttributes *xattr = file_get_attributes(path); |
2839 XAttributes *xattr = file_get_attributes(path, (xattr_filter_func)xattr_filter, dir); |
2829 res->xattr = xattr; |
2840 res->xattr = xattr; |
2830 free(path); |
2841 free(path); |
2831 } |
2842 } |
2832 |
2843 |
2833 return 0; |
2844 return 0; |