dav/sync.c

changeset 502
a23fedac340c
parent 501
868da3f76267
child 503
f84e64afee61
equal deleted inserted replaced
501:868da3f76267 502:a23fedac340c
328 DavBool find_collection = TRUE; 328 DavBool find_collection = TRUE;
329 if((flags & DAV_SESSION_DECRYPT_NAME) != DAV_SESSION_DECRYPT_NAME) { 329 if((flags & DAV_SESSION_DECRYPT_NAME) != DAV_SESSION_DECRYPT_NAME) {
330 url = util_concat_path(repo->url, collection); 330 url = util_concat_path(repo->url, collection);
331 find_collection = FALSE; 331 find_collection = FALSE;
332 } 332 }
333 if(!collection || (collection[0] == '/' && strlen(collection) == 1)) {
334 // collection is NULL or "/"
335 // we don't need to find any collection because the repo url is
336 // the base url
337 find_collection = FALSE;
338 }
333 DavSession *sn = dav_session_new_auth( 339 DavSession *sn = dav_session_new_auth(
334 ctx, 340 ctx,
335 url, 341 url,
336 repo->user, 342 repo->user,
337 repo->password); 343 repo->password);
516 DavBool remove_file = cmd_getoption(a, "remove") ? 1 : 0; 522 DavBool remove_file = cmd_getoption(a, "remove") ? 1 : 0;
517 523
518 int sync_success = 0; 524 int sync_success = 0;
519 int sync_delete = 0; 525 int sync_delete = 0;
520 int sync_error = 0; 526 int sync_error = 0;
527
528 UcxList *ls_get = NULL;
529 UcxList *ls_remove = NULL;
530 UcxList *ls_conflict = NULL;
531 UcxList *ls_broken = NULL;
521 532
522 UcxMap *svrres = ucx_map_new(db->resources->count); 533 UcxMap *svrres = ucx_map_new(db->resources->count);
523 534
524 UcxList *statls = NULL; 535 UcxList *statls = NULL;
525 536
558 569
559 char *status = dav_get_string_property(res, "idav:status"); 570 char *status = dav_get_string_property(res, "idav:status");
560 if(status && !strcmp(status, "broken")) { 571 if(status && !strcmp(status, "broken")) {
561 res = res->next; 572 res = res->next;
562 localres_keep(db, res->path); 573 localres_keep(db, res->path);
574 ls_broken = ucx_list_append(ls_broken, res);
563 continue; 575 continue;
564 } 576 }
565 577
566 // download the resource 578 // download the resource
567 if(!sync_shutdown && sync_get_resource(a, dir, res, db, FALSE, &sync_success)) { 579 if(!sync_shutdown && sync_get_resource(a, dir, res, db, FALSE, &sync_success)) {
662 sync_success, str_success, 674 sync_success, str_success,
663 sync_delete,str_delete, 675 sync_delete,str_delete,
664 sync_error, str_error); 676 sync_error, str_error);
665 } 677 }
666 678
679 return ret;
680 }
681
682 int sync_remote_is_changed(
683 CmdArgs *a,
684 SyncDirectory *dir,
685 DavResource *res,
686 SyncDatabase *db,
687 DavBool force,
688 DavBool *conflict,
689 DavBool *metadataupdate)
690 {
691 int cdt = cmd_getoption(a, "conflict") ? 0 : 1; // conflict detection
692 *conflict = 0;
693 *metadataupdate = 0;
694
695 LocalResource *local = ucx_map_cstr_get(db->resources, res->path);
696 char *local_path = util_concat_path(dir->path, res->path);
697
698 char *etag = dav_get_string_property(res, "D:getetag");
699 SYS_STAT s;
700 int ret = 0;
701
702
703 free(local_path);
667 return ret; 704 return ret;
668 } 705 }
669 706
670 int sync_get_resource( 707 int sync_get_resource(
671 CmdArgs *a, 708 CmdArgs *a,

mercurial