commit 2d1cfc2c7f7262d578b4e52b904c9e471937e2a4
Author: Oswald Buddenhagen <o...@users.sf.net>
Date:   Sun Mar 19 20:21:19 2017 +0100

    make "Patterns *" match INBOX* in Maildir++ Stores
    
    this also has the side effect that we won't fail to include INBOX itself
    when Inbox is nested under Path when using other SubFolder styles
    (regression introduced with Maildir++ support in 0f24ca31b).
    
    REFMAIL: 1489492069.2148187.910409864.7727f...@webmail.messagingengine.com

 src/drv_maildir.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/src/drv_maildir.c b/src/drv_maildir.c
index 327f39e..d933779 100644
--- a/src/drv_maildir.c
+++ b/src/drv_maildir.c
@@ -400,8 +400,7 @@ maildir_list_inbox( store_t *gctx, int flags, const char 
*basePath )
 {
        char path[_POSIX_PATH_MAX], name[_POSIX_PATH_MAX];
 
-       if (flags & LIST_INBOX)
-               add_string_list( &gctx->boxes, "INBOX" );
+       add_string_list( &gctx->boxes, "INBOX" );
        return maildir_list_recurse(
                gctx, 1, flags, 0, 0, basePath, basePath ? strlen( basePath ) - 
1 : 0,
                path, nfsnprintf( path, _POSIX_PATH_MAX, "%s/", 
((maildir_store_conf_t *)gctx->conf)->inbox ),
@@ -426,10 +425,18 @@ maildir_list_store( store_t *gctx, int flags,
                     void (*cb)( int sts, void *aux ), void *aux )
 {
        maildir_store_conf_t *conf = (maildir_store_conf_t *)gctx->conf;
-       if (((((flags & LIST_PATH) && conf->sub_style != SUB_MAILDIRPP)
-             || ((flags & LIST_PATH_MAYBE) && gctx->conf->path))
+
+       // The Maildir++ Inbox is technically not under Path, so "*" would
+       // never match INBOX*, which is rather unintuitive. Matching INBOX*
+       // implicitly instead makes it consistent with an IMAP Store with
+       // an empty Path.
+       if (conf->sub_style == SUB_MAILDIRPP)
+               flags |= LIST_INBOX;
+
+       if ((conf->sub_style != SUB_MAILDIRPP
+            && ((flags & LIST_PATH) || ((flags & LIST_PATH_MAYBE) && 
gctx->conf->path))
             && maildir_list_path( gctx, flags, conf->inbox ) < 0) ||
-           (((flags & LIST_INBOX) || conf->sub_style == SUB_MAILDIRPP)
+           ((flags & LIST_INBOX)
             && maildir_list_inbox( gctx, flags, gctx->conf->path ) < 0)) {
                maildir_invoke_bad_callback( gctx );
                cb( DRV_CANCELED, aux );

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel

Reply via email to