Browse Source

fix handling of maildir Path directly overlapping Inbox

one might want to set `Inbox ~/Maildir` and `Path ~/Maildir/` to get a
self-contained ~/Maildir without resorting to `SubFolders Maildir++`,
though logical sub-folders are possible only with `SubFolders Legacy`.

also document that nesting Path into Inbox is supported in the first
place; amends 98bd2b11.
wip/maildir-path-under-inbox
Oswald Buddenhagen 3 years ago
parent
commit
b4e8b29397
  1. 15
      src/drv_maildir.c
  2. 1
      src/mbsync.1

15
src/drv_maildir.c

@ -451,10 +451,21 @@ maildir_list_inbox( maildir_store_t *ctx, int flags )
ctx->listed |= LIST_INBOX; ctx->listed |= LIST_INBOX;
add_string_list( &ctx->boxes, "INBOX" ); add_string_list( &ctx->boxes, "INBOX" );
uint pathLen = nfsnprintf( path, _POSIX_PATH_MAX, "%s/", ctx->conf->inbox );
const char *basePath = ctx->conf->path; const char *basePath = ctx->conf->path;
uint basePathLen = 0;
if (basePath) {
basePathLen = strlen( basePath ) - 1;
// In verbatim mode, Path "steals" the sub-folders from INBOX
// if it is identical to Inbox. In legacy mode, subdirs are
// dot-prefixed, so no mutual exclusion is necessary.
if (ctx->conf->sub_style == SUB_VERBATIM &&
equals( path, pathLen, basePath, basePathLen )) {
return 0;
}
}
return maildir_list_recurse( return maildir_list_recurse(
ctx, 1, flags, NULL, 0, basePath, basePath ? strlen( basePath ) - 1 : 0, ctx, 1, flags, NULL, 0, basePath, basePathLen, path, pathLen,
path, nfsnprintf( path, _POSIX_PATH_MAX, "%s/", ctx->conf->inbox ),
name, nfsnprintf( name, _POSIX_PATH_MAX, "INBOX/" ) ); name, nfsnprintf( name, _POSIX_PATH_MAX, "INBOX/" ) );
} }

1
src/mbsync.1

@ -274,6 +274,7 @@ See \fBRECOMMENDATIONS\fR below.
\fBInbox\fR \fIpath\fR \fBInbox\fR \fIpath\fR
The location of the \fBINBOX\fR. This is \fInot\fR relative to \fBPath\fR, The location of the \fBINBOX\fR. This is \fInot\fR relative to \fBPath\fR,
but it is allowed to place the \fBINBOX\fR inside the \fBPath\fR. but it is allowed to place the \fBINBOX\fR inside the \fBPath\fR.
Conversely, it is also possible to put \fBPath\fR inside the \fBINBOX\fR.
(Default: \fI~/Maildir\fR) (Default: \fI~/Maildir\fR)
. .
.TP .TP

Loading…
Cancel
Save