49 static UcxMap *repos; |
49 static UcxMap *repos; |
50 static UcxMap *keys; |
50 static UcxMap *keys; |
51 static Proxy *http_proxy; |
51 static Proxy *http_proxy; |
52 static Proxy *https_proxy; |
52 static Proxy *https_proxy; |
53 |
53 |
54 int check_config_dir() { |
54 int check_config_dir(void) { |
55 char *file = util_concat_path(ENV_HOME, ".dav"); |
55 char *file = util_concat_path(ENV_HOME, ".dav"); |
56 int ret = 0; |
56 int ret = 0; |
57 if(util_mkdir(file, S_IRWXU)) { |
57 if(util_mkdir(file, S_IRWXU)) { |
58 if(errno != EEXIST) { |
58 if(errno != EEXIST) { |
59 ret = 1; |
59 ret = 1; |
152 ucx_map_free(repos); |
152 ucx_map_free(repos); |
153 |
153 |
154 ucx_map_free(keys); |
154 ucx_map_free(keys); |
155 } |
155 } |
156 |
156 |
157 Repository* repository_new() { |
157 Repository* repository_new(void) { |
158 Repository *repo = calloc(1, sizeof(Repository)); |
158 Repository *repo = calloc(1, sizeof(Repository)); |
159 repo->encrypt_name = false; |
159 repo->encrypt_name = false; |
160 repo->encrypt_content = false; |
160 repo->encrypt_content = false; |
161 repo->decrypt_name = false; |
161 repo->decrypt_name = false; |
162 repo->decrypt_content = true; |
162 repo->decrypt_content = true; |
539 UCX_MAP_FOREACH(key, repo, i) { |
539 UCX_MAP_FOREACH(key, repo, i) { |
540 printf("%s\n", repo->name); |
540 printf("%s\n", repo->name); |
541 } |
541 } |
542 return 0; |
542 return 0; |
543 } |
543 } |
|
544 |
|
545 UcxList* get_repositories(void) { |
|
546 UcxList *list = NULL; |
|
547 UcxMapIterator i = ucx_map_iterator(repos); |
|
548 Repository *repo; |
|
549 UCX_MAP_FOREACH(key, repo, i) { |
|
550 list = ucx_list_append(list, repo); |
|
551 } |
|
552 return list; |
|
553 } |