add proppatch interface webdav

Sat, 25 Jan 2020 15:34:30 +0100

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sat, 25 Jan 2020 15:34:30 +0100
branch
webdav
changeset 240
cd74667f6c85
parent 239
d5031c30022c
child 241
4adad7faf452

add proppatch interface

src/server/public/webdav.h file | annotate | diff | comparison | revisions
src/server/webdav/webdav.c file | annotate | diff | comparison | revisions
--- 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;
--- 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;
     

mercurial