adds syncdir config element for tag filters

Fri, 01 Jun 2018 09:07:20 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Fri, 01 Jun 2018 09:07:20 +0200
changeset 401
3bb3210f3e6e
parent 400
90c6bfa94fa2
child 402
babdf40dd22c

adds syncdir config element for tag filters

dav/scfg.c file | annotate | diff | comparison | revisions
--- a/dav/scfg.c	Fri Jun 01 09:01:00 2018 +0200
+++ b/dav/scfg.c	Fri Jun 01 09:07:20 2018 +0200
@@ -92,8 +92,12 @@
     }
 }
 
-static int scfg_load_filter(xmlNode *node,
-        UcxList **include, UcxList **exclude) {
+static int scfg_load_filter(
+        xmlNode *node,
+        UcxList **include,
+        UcxList **exclude,
+        SyncTagFilter **tagfilter)
+{
     node = node->children;
     
     while(node) {
@@ -107,6 +111,17 @@
                 if(value) {
                     *exclude = add_regex_pattern(*exclude, value, node->line);
                 }
+            } else if(xstreq(node->name, "tags")) {
+                if(value) {
+                    *tagfilter = parse_tagfilter_string(value);
+                    if(!*tagfilter) {
+                        print_error(
+                                node->line,
+                                "malformed tag filter: %s\n",
+                                value);
+                        return 1;
+                    }
+                }
             } else {
                 print_error(node->line,
                         "unknown filter config element: %s\n", node->name);
@@ -242,6 +257,7 @@
     TagConfig *tagconfig = NULL;
     UcxList *include = NULL;
     UcxList *exclude = NULL;
+    SyncTagFilter *tagfilter = NULL;
     int max_retry = 0;
     int allow_cmd = SYNC_CMD_PULL | SYNC_CMD_PUSH | SYNC_CMD_ARCHIVE;
     bool backuppull = false;
@@ -275,7 +291,7 @@
             } else if(xstreq(node->name, "repository")) {
                 repository = value;
             } else if(xstreq(node->name, "filter")) {
-                if(scfg_load_filter(node, &include, &exclude)) {
+                if(scfg_load_filter(node, &include, &exclude, &tagfilter)) {
                     return 1;
                 }
             } else if(xstreq(node->name, "database")) {

mercurial