dav/sync.c

changeset 530
29e660161b73
parent 529
dc3f82b04733
child 531
fa54e3a1250a
equal deleted inserted replaced
529:dc3f82b04733 530:29e660161b73
3094 DavResource *vcol = dav_resource_new_href(sn, vcol_href); 3094 DavResource *vcol = dav_resource_new_href(sn, vcol_href);
3095 if(!vcol) { 3095 if(!vcol) {
3096 ret = 1; 3096 ret = 1;
3097 break; 3097 break;
3098 } 3098 }
3099 3099
3100 if(dav_load_prop(vcol, NULL, 0)) { 3100 if(dav_load_prop(vcol, NULL, 0)) {
3101 print_resource_error(sn, vcol->path); 3101 print_resource_error(sn, vcol->path);
3102 ret = 1; 3102 ret = 1;
3103 break; 3103 break;
3104 } 3104 }
3105 3105
3106 DavResource *child = vcol->children; 3106 DavResource *child = vcol->children;
3107 UcxList *children = NULL;
3107 while(child) { 3108 while(child) {
3108 time_t now = child->lastmodified; 3109 children = ucx_list_append(children, child);
3110 child = child->next;
3111 }
3112 children = ucx_list_sort(children, ucx_cmp_str, NULL);
3113
3114 DavBool first = 1;
3115 UCX_FOREACH(elm, children) {
3116 DavResource *c = elm->data;
3117 time_t now = c->lastmodified;
3109 struct tm *date = gmtime(&now); 3118 struct tm *date = gmtime(&now);
3110 char str[32]; 3119 char str[32];
3111 putenv("LC_TIME=C"); 3120 putenv("LC_TIME=C");
3112 size_t len = strftime(str, 32, "%a, %d %b %Y %H:%M:%S GMT", date); 3121 size_t len = strftime(str, 32, "%a, %d %b %Y %H:%M:%S GMT", date);
3113 3122
3114 printf("%s%32s\n", str, child->name); 3123 if(!first) {
3115 3124 putchar('\n');
3116 child = child->next; 3125 }
3117 } 3126 printf("name: %s\n", c->name);
3127 printf("lastmodified: %s\n", str);
3128 char *server = util_url_base(sn->base_url);
3129 char *url = util_concat_path(server, c->href);
3130 printf("url: %s\n", url);
3131 free(server);
3132 free(url);
3133 first = 0;
3134 }
3135 ucx_list_free(children);
3118 } while(0); 3136 } while(0);
3119 } 3137 }
3120 3138
3121 free(file.path); 3139 free(file.path);
3122 dav_session_destroy(sn); 3140 dav_session_destroy(sn);

mercurial