# HG changeset patch # User Olaf Wintermann # Date 1568656144 -7200 # Node ID 4e23087d3d90e4feddaa56df582afc2646696071 # Parent b138d1241e68d77daa744103b3cdeb3dba6a9de4 add config element for push strategy diff -r b138d1241e68 -r 4e23087d3d90 dav/scfg.c --- a/dav/scfg.c Sun Sep 15 16:11:58 2019 +0200 +++ b/dav/scfg.c Mon Sep 16 19:49:04 2019 +0200 @@ -398,6 +398,7 @@ time_t lock_timeout = 0; uint32_t metadata = 0; uint32_t symlink = 0; + PushStrategy pushstrat = PUSH_STRATEGY_METADATA; unsigned short parentlineno = node->line; node = node->children; @@ -457,7 +458,7 @@ } } else if(xstreq(node->name, "allow-cmd")) { int cmds = 0; - const char *delims = " ,\r\n"; + const char *delims = " ,\t\r\n"; char *cmdstr = strdup(value); char *cmd = strtok(cmdstr, delims); while(cmd) { @@ -491,7 +492,15 @@ } } else if(xstreq(node->name, "hashing")) { hashing = util_getboolean(value); - store_hash = hashing; // TODO: extra config for this? + store_hash = hashing; + } else if(xstreq(node->name, "push-strategy")) { + if(value) { + if(xstreq(value, "metadata")) { + pushstrat = PUSH_STRATEGY_METADATA; + } else if(xstreq(value, "hash")) { + pushstrat = PUSH_STRATEGY_HASH; + } + } } else if(xstreq(node->name, "symlinks")) { uint32_t symlinkconfig = 0; const char *delims = " ,\r\n"; @@ -557,6 +566,7 @@ dir->metadata = metadata; dir->splitconfig = splitconfig; dir->symlink = symlink; + dir->push_strategy = pushstrat; if((metadata & FINFO_MODE) == FINFO_MODE) { dir->db_settings = DB_STORE_MODE; } diff -r b138d1241e68 -r 4e23087d3d90 dav/scfg.h --- a/dav/scfg.h Sun Sep 15 16:11:58 2019 +0200 +++ b/dav/scfg.h Mon Sep 16 19:49:04 2019 +0200 @@ -62,7 +62,13 @@ typedef struct TagConfig TagConfig; typedef struct Versioning Versioning; typedef struct SplitConfig SplitConfig; - + +enum PushStrategy { + PUSH_STRATEGY_METADATA = 0, + PUSH_STRATEGY_HASH +}; +typedef enum PushStrategy PushStrategy; + typedef struct SyncDirectory { char *name; char *path; @@ -81,6 +87,7 @@ int allow_cmd; uint32_t symlink; time_t lock_timeout; + PushStrategy push_strategy; bool backuppull; bool lockpull; bool lockpush;