# HG changeset patch
# User Olaf Wintermann <olaf.wintermann@gmail.com>
# Date 1579962870 -3600
# Node ID cd74667f6c856e7197511c785812a4794499441d
# Parent  d5031c30022c6f10e42e587fb286b8bf3addceee
add proppatch interface

diff -r d5031c30022c -r cd74667f6c85 src/server/public/webdav.h
--- a/src/server/public/webdav.h	Sat Jan 25 11:16:55 2020 +0100
+++ b/src/server/public/webdav.h	Sat Jan 25 15:34:30 2020 +0100
@@ -80,9 +80,14 @@
 /* propfind settings */
 
 /*
- * Don't use the vfs to stat files or read the directory children
+ * Use the vfs to stat files or read the directory children
  */
-#define WS_PROPFIND_NO_VFS 0x01
+#define WS_WEBDAV_PROPFIND_USE_VFS     0x01
+
+/*
+ * Use the vfs to open a file for proppatch
+ */
+#define WS_WEBDAV_PROPPATCH_USE_VFS   0x02
 
 
 enum WebdavValueType {
@@ -274,6 +279,27 @@
     int (*propfind_finish)(WebdavPropfindRequest *);
     
     /*
+     * int proppatch_do(
+     *     WebdavProppatchRequest *request,
+     *     WebdavResponse *response,
+     *     VFSFile *file);
+     * 
+     * Modifies properties of the requsted resource:
+     */
+    int (*proppatch_do)(WebdavProppatchRequest *, WebdavResponse *, VFSFile *);
+    
+    /*
+     * int proppatch_finish(
+     *     WebdavProppatchRequest *request,
+     *     WSBool commit);
+     * 
+     * Called after all proppatch_do functions of all backends are executed
+     * and should either permanently store the properties (commit == true) or
+     * revert all changed (commit == false).
+     */
+    int (*proppatch_finish)(WebdavProppatchRequest *, WSBool);
+    
+    /*
      * See the WS_PROPFIND_ macros for informations about the settings
      */
     uint32_t settings;
diff -r d5031c30022c -r cd74667f6c85 src/server/webdav/webdav.c
--- a/src/server/webdav/webdav.c	Sat Jan 25 11:16:55 2020 +0100
+++ b/src/server/webdav/webdav.c	Sat Jan 25 15:34:30 2020 +0100
@@ -234,7 +234,8 @@
     
     // some Backends can list all children by themselves, but some
     // require the VFS for this
-    WSBool usevfs = (settings & WS_PROPFIND_NO_VFS) != WS_PROPFIND_NO_VFS;
+    WSBool usevfs = (settings & WS_WEBDAV_PROPFIND_USE_VFS)
+                        == WS_WEBDAV_PROPFIND_USE_VFS;
     struct stat s;
     struct stat *statptr = NULL;