add link target to sync db

Sun, 14 Apr 2019 16:28:36 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sun, 14 Apr 2019 16:28:36 +0200
changeset 572
1eac93fcef77
parent 571
f6de48471c9c
child 573
b8f798d240ab

add link target to sync db

dav/db.c file | annotate | diff | comparison | revisions
dav/db.h file | annotate | diff | comparison | revisions
--- a/dav/db.c	Sat Apr 13 16:51:22 2019 +0200
+++ b/dav/db.c	Sun Apr 14 16:28:36 2019 +0200
@@ -213,6 +213,8 @@
                 field = 10;
             } else if(xstreq(name, "hash")) {
                 field = 11;
+            } else if(xstreq(name, "link")) {
+                field = 12;
             } else if(xstreq(name, "skipped")) {
                 res->skipped = TRUE;
             } else if(xstreq(name, "tags-updated")) {
@@ -308,6 +310,10 @@
                     res->hash = strdup((char*)value);
                     break;
                 }
+                case 12: {
+                    res->link_target = strdup((char*)value);
+                    break;
+                }
             }
         } else if(XML_READER_TYPE_END_ELEMENT) {
             if(xstreq(name, "resource")) {
@@ -515,6 +521,18 @@
             }
         }
         
+        if(res->link_target) {
+            r = xmlTextWriterWriteElement(
+                    writer,
+                    BAD_CAST "link",
+                    BAD_CAST res->link_target);
+            if(r < 0) {
+                fprintf(stderr, "Cannot write link: %s\n", res->link_target);
+                xmlFreeTextWriter(writer);
+                return -1;
+            }
+        }
+        
         if(res->xattr_hash) {
             r = xmlTextWriterWriteElement(
                     writer,
--- a/dav/db.h	Sat Apr 13 16:51:22 2019 +0200
+++ b/dav/db.h	Sun Apr 14 16:28:36 2019 +0200
@@ -68,6 +68,8 @@
     char *xattr_hash;
     char *remote_tags_hash;
     
+    char *link_target;
+    
     FilePart *parts;
     size_t numparts;
     

mercurial