isync

mailbox synchronization program
git clone https://git.code.sf.net/p/isync/isync
Log | Files | Refs | README | LICENSE

commit 4d638c3cf274a64f011e7b703d37215447551cfd
parent d8225390fcd3d31577d3d74ab3d18b8762c5008b
Author: Oswald Buddenhagen <ossi@users.sf.net>
Date:   Thu, 26 Mar 2015 14:28:06 +0100

make sure that INBOX always exists

makes the Maildir driver consistent with IMAP.

Diffstat:
Msrc/drv_maildir.c | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/drv_maildir.c b/src/drv_maildir.c @@ -68,7 +68,7 @@ typedef struct maildir_message { typedef struct maildir_store { store_t gen; - int uvfd, uvok, nuid, fresh[3]; + int uvfd, uvok, nuid, is_inbox, fresh[3]; int minuid, maxuid, newuid, nexcs, *excs; char *trash; #ifdef USE_DB @@ -1039,12 +1039,14 @@ maildir_select_box( store_t *gctx, const char *name ) ctx->fresh[0] = ctx->fresh[1] = 0; if (starts_with( name, -1, "INBOX", 5 ) && (!name[5] || name[5] == '/')) { gctx->path = maildir_join_path( ((maildir_store_conf_t *)gctx->conf)->inbox, name + 5 ); + ctx->is_inbox = !name[5]; } else { if (maildir_validate_path( gctx->conf ) < 0) { gctx->path = 0; return DRV_CANCELED; } gctx->path = maildir_join_path( gctx->conf->path, name ); + ctx->is_inbox = 0; } return DRV_OK; } @@ -1057,7 +1059,7 @@ maildir_open_box( store_t *gctx, int ret; char uvpath[_POSIX_PATH_MAX]; - if ((ret = maildir_validate( gctx->path, 0, ctx )) != DRV_OK) + if ((ret = maildir_validate( gctx->path, ctx->is_inbox, ctx )) != DRV_OK) goto bail; nfsnprintf( uvpath, sizeof(uvpath), "%s/.uidvalidity", gctx->path );