Hi Mark and Oswald,
I was wondering if there was a solution found for the problem you described,
ie. a solution accepted and integrated by Oswald.
I've been using mbsync for quite a long time, and I had a patch since version
1.0.4 for this dots (I hesitate to talk about issue as Maildir++ format requires
them).
Anyway, if there is a solution I'll hapily use it. If not, for a reference I'm
using the patch in [1] upon isync 1.1.1, which adds a DropDots option to
maildir store.
Cheers.
--
Robert
[1] RJK's Patch
diff -ru isync-1.1.1_prerjk/src/drv_maildir.c isync-1.1.1/src/drv_maildir.c
--- isync-1.1.1_prerjk/src/drv_maildir.c2015-04-17 20:37:09.485528699
+0200
+++ isync-1.1.1/src/drv_maildir.c 2015-04-19 11:56:04.481529784 +0200
@@ -54,6 +54,8 @@
typedef struct maildir_store_conf {
store_conf_t gen;
char *inbox;
+ char *root_path;
+ int drop_dot;
#ifdef USE_DB
int alt_map;
#endif /* USE_DB */
@@ -99,11 +101,12 @@
}
static char *
-maildir_join_path( const char *prefix, const char *box )
+maildir_join_path(maildir_store_t *ctx, const char *prefix, const char *box )
{
char *out, *p;
int pl, bl, n;
char c;
+ maildir_store_conf_t *conf = (maildir_store_conf_t *)ctx-gen.conf;
pl = strlen( prefix );
for (bl = 0, n = 0; (c = box[bl]); bl++)
@@ -114,7 +117,7 @@
p = out + pl;
while ((c = *box++)) {
*p++ = c;
- if (c == '/')
+ if ((c == '/') !conf-drop_dot)
*p++ = '.';
}
*p = 0;
@@ -137,7 +140,7 @@
ctx-gen.conf = conf;
ctx-uvfd = -1;
if (conf-trash)
- ctx-trash = maildir_join_path( conf-path, conf-trash );
+ ctx-trash = maildir_join_path( ctx, conf-path, conf-trash );
cb( ctx-gen, aux );
}
@@ -199,6 +202,7 @@
int pl, nl, missing;
struct dirent *de;
struct stat st;
+ maildir_store_conf_t *conf = (maildir_store_conf_t *)gctx-conf;
if (isBox) {
path[pathLen++] = '/';
@@ -224,12 +228,13 @@
return -1;
}
} else {
- if (*ent == '.') {
- if (!isBox)
+ if ((*ent == '.') || (de-d_type DT_DIR)) {
+ if (!isBox !conf-drop_dot)
continue;
if (!ent[1] || ent[1] == '.')
continue;
- ent++;
+ if (!conf-drop_dot)
+ ent++;
} else {
if (isBox)
continue;
@@ -321,16 +326,20 @@
struct dirent *entry;
char *p;
time_t now;
- int i, bl, ret;
+ int i, bl, ret, is_root;
struct stat st;
char buf[_POSIX_PATH_MAX];
+ maildir_store_conf_t *conf = (maildir_store_conf_t *)ctx-gen.conf;
bl = nfsnprintf( buf, sizeof(buf) - 4, %s/, box );
+ is_root = !strcmp(conf-root_path, box);
+ if (is_root)
+ return 0;
if (stat( buf, st )) {
if (errno == ENOENT) {
if (create) {
p = memrchr( buf, '/', bl - 1 );
- if (*(p + 1) == '.') {
+ if (conf-drop_dot || (*(p + 1) == '.')) {
*p = 0;
if ((ret = maildir_validate( buf, 1,
ctx )) != DRV_OK)
return ret;
@@ -669,7 +678,7 @@
return DRV_BOX_BAD;
}
while ((e = readdir( d ))) {
- if (*e-d_name == '.')
+ if ((*e-d_name == '.') || (e-d_type DT_DIR))
continue;
ctx-gen.count++;
ctx-gen.recent += i;
@@ -917,8 +926,8 @@
#endif /* USE_DB */
gctx-path =
(!memcmp( gctx-name, INBOX, 5 ) (!gctx-name[5] ||
gctx-name[5] == '/')) ?
- maildir_join_path( ((maildir_store_conf_t
*)gctx-conf)-inbox, gctx-name + 5 ) :
- maildir_join_path( gctx-conf-path, gctx-name );
+ maildir_join_path( ctx, ((maildir_store_conf_t
*)gctx-conf)-inbox, gctx-name + 5 ) :
+ maildir_join_path( ctx, gctx-conf-path, gctx-name );
if ((ret = maildir_validate( gctx-path, create, ctx )) != DRV_OK) {
cb( ret, aux );
@@ -1458,12 +1467,18 @@
while (getcline( cfg ) cfg-cmd)
if (!strcasecmp( Inbox, cfg-cmd ))