changes list-versions output

Wed, 20 Mar 2019 09:27:29 +0100

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Wed, 20 Mar 2019 09:27:29 +0100
changeset 530
29e660161b73
parent 529
dc3f82b04733
child 531
fa54e3a1250a

changes list-versions output

dav/sync.c file | annotate | diff | comparison | revisions
--- a/dav/sync.c	Tue Mar 19 20:31:17 2019 +0100
+++ b/dav/sync.c	Wed Mar 20 09:27:29 2019 +0100
@@ -3096,7 +3096,7 @@
                 ret = 1;
                 break;
             }
-            
+                       
             if(dav_load_prop(vcol, NULL, 0)) {
                 print_resource_error(sn, vcol->path);
                 ret = 1;
@@ -3104,17 +3104,35 @@
             }
             
             DavResource *child = vcol->children;
+            UcxList *children = NULL;
             while(child) {
-                time_t now = child->lastmodified;
+                children = ucx_list_append(children, child);
+                child = child->next;
+            }
+            children = ucx_list_sort(children, ucx_cmp_str, NULL);
+            
+            DavBool first = 1;
+            UCX_FOREACH(elm, children) {
+                DavResource *c = elm->data;
+                time_t now = c->lastmodified;
                 struct tm *date = gmtime(&now);
                 char str[32];
                 putenv("LC_TIME=C");
                 size_t len = strftime(str, 32, "%a, %d %b %Y %H:%M:%S GMT", date);
                 
-                printf("%s%32s\n", str, child->name);
-                
-                child = child->next;
+                if(!first) {
+                    putchar('\n');
+                }
+                printf("name: %s\n", c->name);
+                printf("lastmodified: %s\n", str);
+                char *server = util_url_base(sn->base_url);
+                char *url = util_concat_path(server, c->href);
+                printf("url: %s\n", url);
+                free(server);
+                free(url);
+                first = 0;
             }
+            ucx_list_free(children);
         } while(0);
     }
     

mercurial