commit 17f3348ff1765a4238a2202a224510e942453260
Author: Oswald Buddenhagen <o...@users.sf.net>
Date:   Sat May 23 11:06:17 2015 +0200

    make it possible to specifiy Pattern INBOX* with no Path defined
    
    that pattern may very well expand to INBOXNOT, which would naturally
    live under Path, so we need to look into the Path. of course, this
    actually makes sense only if there *is* a Path, and complaining about
    it being absent is backwards.

 src/driver.h      |    5 +++--
 src/drv_imap.c    |    4 ++--
 src/drv_maildir.c |    5 +++--
 src/main.c        |    9 ++++-----
 4 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/src/driver.h b/src/driver.h
index 358f52d..1abf671 100644
--- a/src/driver.h
+++ b/src/driver.h
@@ -139,8 +139,9 @@ typedef struct {
 */
 #define DRV_VERBOSE     2
 
-#define LIST_PATH       1
-#define LIST_INBOX      2
+#define LIST_INBOX      1
+#define LIST_PATH       2
+#define LIST_PATH_MAYBE 4
 
 struct driver {
        int flags;
diff --git a/src/drv_imap.c b/src/drv_imap.c
index cf02760..f27e58e 100644
--- a/src/drv_imap.c
+++ b/src/drv_imap.c
@@ -2620,10 +2620,10 @@ imap_list_store( store_t *gctx, int flags,
        imap_store_t *ctx = (imap_store_t *)gctx;
        struct imap_cmd_refcounted_state *sts = imap_refcounted_new_state( cb, 
aux );
 
-       if ((flags & LIST_PATH) && (!(flags & LIST_INBOX) || !is_inbox( ctx, 
ctx->prefix, -1 )))
+       if ((flags & (LIST_PATH | LIST_PATH_MAYBE)) && (!(flags & LIST_INBOX) 
|| !is_inbox( ctx, ctx->prefix, -1 )))
                imap_exec( ctx, imap_refcounted_new_cmd( sts ), 
imap_refcounted_done_box,
                           "LIST \"\" \"%\\s*\"", ctx->prefix );
-       if ((flags & LIST_INBOX) && (!(flags & LIST_PATH) || *ctx->prefix))
+       if ((flags & LIST_INBOX) && (!(flags & (LIST_PATH | LIST_PATH_MAYBE)) 
|| *ctx->prefix))
                imap_exec( ctx, imap_refcounted_new_cmd( sts ), 
imap_refcounted_done_box,
                           "LIST \"\" INBOX*" );
        imap_refcounted_done( sts );
diff --git a/src/drv_maildir.c b/src/drv_maildir.c
index 3f000ff..a91b7cc 100644
--- a/src/drv_maildir.c
+++ b/src/drv_maildir.c
@@ -325,7 +325,7 @@ maildir_list_recurse( store_t *gctx, int isBox, int flags,
                        }
                } else if (basePath && equals( path, pl, basePath, basePathLen 
)) {
                        /* Path nested into Inbox. List now if it won't be 
listed separately anyway. */
-                       if (!(flags & LIST_PATH) && maildir_list_path( gctx, 
flags, 0 ) < 0) {
+                       if (!(flags & (LIST_PATH | LIST_PATH_MAYBE)) && 
maildir_list_path( gctx, flags, 0 ) < 0) {
                                closedir( dir );
                                return -1;
                        }
@@ -401,7 +401,8 @@ static void
 maildir_list_store( store_t *gctx, int flags,
                     void (*cb)( int sts, void *aux ), void *aux )
 {
-       if (((flags & LIST_PATH) && maildir_list_path( gctx, flags, 
((maildir_store_conf_t *)gctx->conf)->inbox ) < 0) ||
+       if ((((flags & LIST_PATH) || ((flags & LIST_PATH_MAYBE) && 
gctx->conf->path))
+            && maildir_list_path( gctx, flags, ((maildir_store_conf_t 
*)gctx->conf)->inbox ) < 0) ||
            ((flags & LIST_INBOX) && maildir_list_inbox( gctx, flags, 
gctx->conf->path ) < 0)) {
                maildir_invoke_bad_callback( gctx );
                cb( DRV_CANCELED, aux );
diff --git a/src/main.c b/src/main.c
index fa0b936..c8c3bf2 100644
--- a/src/main.c
+++ b/src/main.c
@@ -945,13 +945,12 @@ store_connected( int sts, void *aux )
                                                                flags |= 
LIST_PATH;
                                                        else
                                                                flags |= 
LIST_INBOX;
+                                               } else if (c == '*' || c == 
'%') {
+                                                       /* It can be both INBOX 
and Path, but don't require Path to be configured. */
+                                                       flags |= LIST_INBOX | 
LIST_PATH_MAYBE;
                                                } else {
-                                                       /* User may not want 
the INBOX after all ... */
+                                                       /* It's definitely not 
the INBOX. */
                                                        flags |= LIST_PATH;
-                                                       /* ... but maybe he 
does.
-                                                        * The flattened 
sub-folder case is implicitly covered by the previous line. */
-                                                       if (c == '*' || c == 
'%')
-                                                               flags |= 
LIST_INBOX;
                                                }
                                        } else {
                                                flags |= LIST_PATH;

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel

Reply via email to