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.
This commit is contained in:
parent
72c2d695ac
commit
17f3348ff1
|
@ -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;
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue
Block a user