From 003ddb219947cd2a358843d67ba3aa501660ccba Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Sat, 4 Oct 2014 13:12:50 +0200 Subject: [PATCH] permit IMAP Stores with explicitly empty Path this is useful if the server sends an unhelpful NAMESPACE like "INBOX." (which precludes clean use of Patterns with the real INBOX). --- src/drv_imap.c | 8 ++++---- src/mbsync.1 | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/drv_imap.c b/src/drv_imap.c index 113d608..70118e2 100644 --- a/src/drv_imap.c +++ b/src/drv_imap.c @@ -1742,7 +1742,7 @@ imap_open_store_namespace( imap_store_t *ctx ) ctx->prefix = cfg->gen.path; ctx->delimiter = cfg->delimiter ? nfstrdup( cfg->delimiter ) : 0; - if (((!*ctx->prefix && cfg->use_namespace) || !cfg->delimiter) && CAP(NAMESPACE)) { + if (((!ctx->prefix && cfg->use_namespace) || !cfg->delimiter) && CAP(NAMESPACE)) { /* get NAMESPACE info */ if (!ctx->got_namespace) imap_exec( ctx, 0, imap_open_store_namespace_p2, "NAMESPACE" ); @@ -1776,7 +1776,7 @@ imap_open_store_namespace2( imap_store_t *ctx ) is_atom( (nsp_1st_ns = nsp_1st->child) ) && is_atom( (nsp_1st_dl = nsp_1st_ns->next) )) { - if (!*ctx->prefix && cfg->use_namespace) + if (!ctx->prefix && cfg->use_namespace) ctx->prefix = nsp_1st_ns->val; if (!ctx->delimiter) ctx->delimiter = nfstrdup( nsp_1st_dl->val ); @@ -1790,6 +1790,8 @@ static void imap_open_store_finalize( imap_store_t *ctx ) { set_bad_callback( &ctx->gen, 0, 0 ); + if (!ctx->prefix) + ctx->prefix = ""; ctx->trashnc = TrashUnknown; ctx->callbacks.imap_open( &ctx->gen, ctx->callback_aux ); } @@ -2381,8 +2383,6 @@ imap_parse_store( conffile_t *cfg, store_conf_t **storep ) error( "%s '%s' has both Account and account-specific options\n", type, name ); cfg->err = 1; } - if (!store->gen.path) - store->gen.path = ""; } return 1; } diff --git a/src/mbsync.1 b/src/mbsync.1 index 020b6f8..2af9178 100644 --- a/src/mbsync.1 +++ b/src/mbsync.1 @@ -133,7 +133,7 @@ but is not considered part of them; this is important for \fBPatterns\fR in the Channels section. Note that you \fBmust\fR append a slash if you want to specify an entire directory. -(Default: \fI""\fR) +(Default: none) .. .TP \fBMaxSize\fR \fIsize\fR[\fBk\fR|\fBm\fR][\fBb\fR]