|
|
@ -706,29 +706,30 @@ store_opened( store_t *ctx, void *aux ) |
|
|
|
for (flags = 0, cpat = mvars->chan->patterns; cpat; cpat = cpat->next) { |
|
|
|
for (flags = 0, cpat = mvars->chan->patterns; cpat; cpat = cpat->next) { |
|
|
|
const char *pat = cpat->string; |
|
|
|
const char *pat = cpat->string; |
|
|
|
if (*pat != '!') { |
|
|
|
if (*pat != '!') { |
|
|
|
int i; |
|
|
|
/* Partial matches like "INB*" or even "*" are not considered,
|
|
|
|
char c; |
|
|
|
* except implicity when the INBOX lives under Path. */ |
|
|
|
static const char strinbox[] = "INBOX"; |
|
|
|
if (!memcmp( pat, "INBOX", 5 )) { |
|
|
|
for (i = 0; ; i++) { |
|
|
|
char c = pat[5]; |
|
|
|
c = pat[i]; |
|
|
|
|
|
|
|
if (i == sizeof(strinbox) - 1) |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
if (c != strinbox[i]) |
|
|
|
|
|
|
|
goto nextpat; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (!c) { |
|
|
|
if (!c) { |
|
|
|
|
|
|
|
/* User really wants the INBOX. */ |
|
|
|
flags |= LIST_INBOX; |
|
|
|
flags |= LIST_INBOX; |
|
|
|
} else if (c == '/') { |
|
|
|
} else if (c == '/') { |
|
|
|
|
|
|
|
/* Flattened sub-folders of INBOX actually end up in Path. */ |
|
|
|
if (ctx->conf->flat_delim) |
|
|
|
if (ctx->conf->flat_delim) |
|
|
|
flags |= LIST_PATH; |
|
|
|
flags |= LIST_PATH; |
|
|
|
else |
|
|
|
else |
|
|
|
flags |= LIST_INBOX; |
|
|
|
flags |= LIST_INBOX; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
nextpat: |
|
|
|
/* User may not want the INBOX after all ... */ |
|
|
|
flags |= LIST_PATH; |
|
|
|
flags |= LIST_PATH; |
|
|
|
|
|
|
|
/* ... but maybe he does.
|
|
|
|
|
|
|
|
* The flattened sub-folder case is implicitly covered by the previous line. */ |
|
|
|
if (c == '*' || c == '%') |
|
|
|
if (c == '*' || c == '%') |
|
|
|
flags |= LIST_INBOX; |
|
|
|
flags |= LIST_INBOX; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
flags |= LIST_PATH; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
set_bad_callback( ctx, store_bad, AUX ); |
|
|
|
set_bad_callback( ctx, store_bad, AUX ); |
|
|
|