From 66895f9cced05e72d8e2668636e25bacf073534a Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Sun, 16 Sep 2012 12:34:07 +0200 Subject: [PATCH] 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. --- src/main.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/main.c b/src/main.c index 0370125..5e8bb49 100644 --- a/src/main.c +++ b/src/main.c @@ -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 );