try harder to list all necessary boxes

the pattern "INB*" may or may not refer to something in the INBOX. even
just "*" may. so list both the INBOX and the Path in case of
uncertainty.
This commit is contained in:
Oswald Buddenhagen 2012-09-16 12:34:07 +02:00
parent 35851f133b
commit 66895f9cce

View File

@ -702,8 +702,26 @@ store_opened( store_t *ctx, void *aux )
if (!mvars->skip && !mvars->boxlist && mvars->chan->patterns && !ctx->listed) {
for (flags = 0, cpat = mvars->chan->patterns; cpat; cpat = cpat->next) {
const char *pat = cpat->string;
if (*pat != '!')
flags |= (!memcmp( pat, "INBOX", 5 ) && (!pat[5] || pat[5] == '/')) ? LIST_INBOX : LIST_PATH;
if (*pat != '!') {
int i;
char c;
static const char strinbox[] = "INBOX";
for (i = 0; ; i++) {
c = pat[i];
if (i == sizeof(strinbox) - 1)
break;
if (c != strinbox[i])
goto nextpat;
}
if (!c || c == '/') {
flags |= LIST_INBOX;
} else {
nextpat:
flags |= LIST_PATH;
if (c == '*' || c == '%')
flags |= LIST_INBOX;
}
}
}
set_bad_callback( ctx, store_bad, AUX );
mvars->drv[t]->list( ctx, flags, store_listed, AUX );