159 |
159 |
160 char *new_url = NULL; |
160 char *new_url = NULL; |
161 if(dir->collection) { |
161 if(dir->collection) { |
162 new_url = util_concat_path(repo->url, dir->collection); |
162 new_url = util_concat_path(repo->url, dir->collection); |
163 } |
163 } |
|
164 // TODO: session creator function |
164 DavSession *sn = dav_session_new_auth( |
165 DavSession *sn = dav_session_new_auth( |
165 ctx, |
166 ctx, |
166 new_url ? new_url : repo->url, |
167 new_url ? new_url : repo->url, |
167 repo->user, |
168 repo->user, |
168 repo->password); |
169 repo->password); |
169 if(new_url) { |
170 if(new_url) { |
170 free(new_url); |
171 free(new_url); |
171 } |
172 } |
172 dav_session_set_flags(sn, get_repository_flags(repo)); |
173 sn->flags = get_repository_flags(repo); |
173 sn->key = dav_context_get_key(ctx, repo->default_key); |
174 sn->key = dav_context_get_key(ctx, repo->default_key); |
|
175 if (cmd_getoption(a, "verbose")) { |
|
176 curl_easy_setopt(sn->handle, CURLOPT_VERBOSE, 1L); |
|
177 curl_easy_setopt(sn->handle, CURLOPT_STDERR, stderr); |
|
178 } |
174 |
179 |
175 DavResource *ls = dav_query(sn, "get D:getetag from / where lastmodified > 0 with depth -1"); |
180 DavResource *ls = dav_query(sn, "get D:getetag from / where lastmodified > 0 with depth -1"); |
176 if(!ls) { |
181 if(!ls) { |
177 fprintf(stderr, "Error\n"); |
182 fprintf(stderr, "Error\n"); |
178 // TODO: free |
183 // TODO: free |
458 |
463 |
459 char *new_url = NULL; |
464 char *new_url = NULL; |
460 if(dir->collection) { |
465 if(dir->collection) { |
461 new_url = util_concat_path(repo->url, dir->collection); |
466 new_url = util_concat_path(repo->url, dir->collection); |
462 } |
467 } |
|
468 // TODO: session creator function |
463 DavSession *sn = dav_session_new_auth( |
469 DavSession *sn = dav_session_new_auth( |
464 ctx, |
470 ctx, |
465 new_url ? new_url : repo->url, |
471 new_url ? new_url : repo->url, |
466 repo->user, |
472 repo->user, |
467 repo->password); |
473 repo->password); |
468 if(new_url) { |
474 if(new_url) { |
469 free(new_url); |
475 free(new_url); |
470 } |
476 } |
471 dav_session_set_flags(sn, get_repository_flags(repo)); |
477 sn->flags = get_repository_flags(repo); |
472 sn->key = dav_context_get_key(ctx, repo->default_key); |
478 sn->key = dav_context_get_key(ctx, repo->default_key); |
|
479 if (cmd_getoption(a, "verbose")) { |
|
480 curl_easy_setopt(sn->handle, CURLOPT_VERBOSE, 1L); |
|
481 curl_easy_setopt(sn->handle, CURLOPT_STDERR, stderr); |
|
482 } |
473 |
483 |
474 // upload all changed files |
484 // upload all changed files |
475 UcxList *resources = cmd_getoption(a, "read") ? |
485 UcxList *resources = cmd_getoption(a, "read") ? |
476 read_changes(dir, db) : local_scan(dir, db); |
486 read_changes(dir, db) : local_scan(dir, db); |
477 |
487 |