Sat, 28 Sep 2019 09:09:14 +0200
change metadata config
dav/finfo.c | file | annotate | diff | comparison | revisions | |
dav/finfo.h | file | annotate | diff | comparison | revisions | |
dav/scfg.c | file | annotate | diff | comparison | revisions | |
dav/sync.c | file | annotate | diff | comparison | revisions |
--- a/dav/finfo.c Fri Sep 20 20:27:05 2019 +0200 +++ b/dav/finfo.c Sat Sep 28 09:09:14 2019 +0200 @@ -46,7 +46,7 @@ scstr_t s = scstr(str); if(!sstrcmp(s, SC("*")) || !sstrcmp(s, SC("a")) || !sstrcmp(s, SC("all"))) { - return FINFO_DATE|FINFO_OWNER|FINFO_MODE|FINFO_XATTR; + return FINFO_MTIME|FINFO_OWNER|FINFO_MODE|FINFO_XATTR; } ssize_t count = 0; @@ -57,8 +57,8 @@ uint32_t finfo = 0; for(int i=0;i<count;i++) { sstr_t f = fs[i]; - if(!sstrcasecmp(f, SC("date"))) { - finfo |= FINFO_DATE; + if(!sstrcasecmp(f, SC("mtime"))) { + finfo |= FINFO_MTIME; } else if(!sstrcasecmp(f, SC("owner"))) { finfo |= FINFO_OWNER; } else if(!sstrcasecmp(f, SC("mode"))) { @@ -97,7 +97,7 @@ DavXmlNode *content = NULL; DavXmlNode *last = NULL; - if((finfo & FINFO_DATE) == FINFO_DATE) { + if((finfo & FINFO_MTIME) == FINFO_MTIME) { char str[32]; struct tm *date = gmtime(&s->st_mtime); strftime(str, 32, "%a, %d %b %Y %H:%M:%S GMT", date);
--- a/dav/finfo.h Fri Sep 20 20:27:05 2019 +0200 +++ b/dav/finfo.h Sat Sep 28 09:09:14 2019 +0200 @@ -39,7 +39,7 @@ extern "C" { #endif -#define FINFO_DATE 1 +#define FINFO_MTIME 1 #define FINFO_OWNER 2 #define FINFO_MODE 4 #define FINFO_XATTR 8
--- a/dav/scfg.c Fri Sep 20 20:27:05 2019 +0200 +++ b/dav/scfg.c Sat Sep 28 09:09:14 2019 +0200 @@ -440,12 +440,26 @@ return 1; } } else if(xstreq(node->name, "metadata")) { - char *error = NULL; - metadata = parse_finfo_settings(value, &error); - if(error) { - print_error(node->line, "unknown metadata: %s\n", error); - free(error); + uint32_t md = 0; + + const char *delims = " ,\t\r\n"; + char *metadatastr = strdup(value); + char *m = strtok(metadatastr, delims); + while(m) { + if(!strcmp(m, "mtime")) { + md |= FINFO_MTIME; + } else if(!strcmp(m, "mode")) { + md |= FINFO_MODE; + } else if(!strcmp(m, "owner")) { + md |= FINFO_OWNER; + } else if(!strcmp(m, "xattr")) { + md |= FINFO_XATTR; + } + m = strtok(NULL, delims); } + free(metadatastr); + + metadata = md; } else if(xstreq(node->name, "versioning")) { versioning = parse_versioning_config(node); } else if(xstreq(node->name, "max-retry")) {
--- a/dav/sync.c Fri Sep 20 20:27:05 2019 +0200 +++ b/dav/sync.c Sat Sep 28 09:09:14 2019 +0200 @@ -3148,7 +3148,7 @@ if(fileinfo) { FileInfo f; finfo_get_values(fileinfo, &f); - if((dir->metadata & FINFO_DATE) == FINFO_DATE && f.date_set) { + if((dir->metadata & FINFO_MTIME) == FINFO_MTIME && f.date_set) { // set mtime struct utimbuf t; t.actime = f.last_modified;