isync

mailbox synchronization program
git clone https://git.code.sf.net/p/isync/isync
Log | Files | Refs | README | LICENSE

commit 66895f9cced05e72d8e2668636e25bacf073534a
parent 35851f133bf39da0e814e9681d6a7fcc62431de6
Author: Oswald Buddenhagen <ossi@users.sf.net>
Date:   Sun, 16 Sep 2012 12:34:07 +0200

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.

Diffstat:
Msrc/main.c | 22++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)

diff --git 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 );