dav/sync.c

branch
v1.0
changeset 303
5d79c108fcab
parent 294
dd5c0ebdf54f
equal deleted inserted replaced
301:cbea102875a8 303:5d79c108fcab
863 UcxMapIterator i = ucx_map_iterator(db->resources); 863 UcxMapIterator i = ucx_map_iterator(db->resources);
864 LocalResource *local; 864 LocalResource *local;
865 UCX_MAP_FOREACH(key, local, i) { 865 UCX_MAP_FOREACH(key, local, i) {
866 if (!res_matches_filter(dir, local->path+1)) { 866 if (!res_matches_filter(dir, local->path+1)) {
867 if(sync_delete_remote_resource(sn, local, &sync_delete)) { 867 if(sync_delete_remote_resource(sn, local, &sync_delete)) {
868 ucx_map_cstr_put(lclres, local->path, local); 868 ucx_map_cstr_put(lclres, local->path, local_resource_copy(local));
869 if(sn->error != DAV_NOT_FOUND) { 869 if(sn->error != DAV_NOT_FOUND) {
870 print_resource_error(sn, local->path); 870 print_resource_error(sn, local->path);
871 sync_error++; 871 sync_error++;
872 break; 872 break;
873 } 873 }
1036 res->path = util_concat_path(path, "/"); 1036 res->path = util_concat_path(path, "/");
1037 res->last_modified = s.st_mtime; 1037 res->last_modified = s.st_mtime;
1038 res->isdirectory = 1; 1038 res->isdirectory = 1;
1039 return res; 1039 return res;
1040 } 1040 }
1041 }
1042
1043 LocalResource* local_resource_copy(LocalResource *res) {
1044 LocalResource *newres = calloc(1, sizeof(LocalResource));
1045 if(res->name) {
1046 newres->name = strdup(res->name);
1047 }
1048 if(res->path) {
1049 newres->path = strdup(res->path);
1050 }
1051 if(res->etag) {
1052 newres->etag = strdup(res->etag);
1053 }
1054 newres->skipped = res->skipped;
1055 newres->size = res->size;
1056 newres->last_modified = res->last_modified;
1057 newres->isdirectory = res->isdirectory;
1058 return newres;
1041 } 1059 }
1042 1060
1043 int local_resource_is_changed(SyncDirectory *dir, SyncDatabase *db, LocalResource *res) { 1061 int local_resource_is_changed(SyncDirectory *dir, SyncDatabase *db, LocalResource *res) {
1044 LocalResource *db_res = ucx_map_cstr_get(db->resources, res->path); 1062 LocalResource *db_res = ucx_map_cstr_get(db->resources, res->path);
1045 if(db_res) { 1063 if(db_res) {

mercurial