[dovecot-cvs] dovecot/src/imap cmd-list.c,1.53,1.54
cras at dovecot.org
cras at dovecot.org
Mon Aug 7 00:45:22 EEST 2006
Update of /var/lib/cvs/dovecot/src/imap
In directory talvi:/tmp/cvs-serv10889
Modified Files:
cmd-list.c
Log Message:
Fixes to handling INBOX in LIST.
Index: cmd-list.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/cmd-list.c,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -d -r1.53 -r1.54
--- cmd-list.c 6 Aug 2006 20:58:53 -0000 1.53
+++ cmd-list.c 6 Aug 2006 21:45:12 -0000 1.54
@@ -141,7 +141,7 @@
if (ctx->glob != NULL &&
imap_match(ctx->glob, name) != IMAP_MATCH_YES)
continue;
- } else if (strcasecmp(list->name, "INBOX") == 0) {
+ } else if (strcasecmp(name, "INBOX") == 0) {
if (!ctx->ns->inbox)
continue;
@@ -219,6 +219,8 @@
const char *cur_ns_prefix, *cur_ref, *cur_mask;
enum imap_match_result match;
enum mailbox_list_flags list_flags;
+ enum imap_match_result inbox_match;
+ struct imap_match_glob *inbox_glob;
unsigned int count;
size_t len;
@@ -261,11 +263,19 @@
}
}
- /* INBOX check is done only in the beginning of mask. */
+ /* if the original reference and mask combined produces something
+ that matches INBOX, the INBOX casing is on. */
+ inbox_glob = imap_match_init(cmd->pool,
+ t_strconcat(ctx->ref, ctx->mask, NULL),
+ TRUE, ns->sep);
+ inbox_match = imap_match(inbox_glob, "INBOX");
+ ctx->match_inbox = inbox_match == IMAP_MATCH_YES;
+
ctx->glob = imap_match_init(cmd->pool, ctx->mask,
- cur_mask == ctx->mask, ns->sep);
- ctx->match_inbox = *cur_ref != '\0' ? FALSE :
- imap_match(ctx->glob, "INBOX") == IMAP_MATCH_YES;
+ (inbox_match == IMAP_MATCH_YES ||
+ inbox_match == IMAP_MATCH_PARENT) &&
+ cur_mask == ctx->mask,
+ ns->sep);
if (*cur_ns_prefix != '\0') {
/* namespace prefix still wasn't completely skipped over.
@@ -367,7 +377,7 @@
cur_mask = namespace_fix_sep(ns, cur_mask);
list_flags = ctx->list_flags;
- if (*ns->prefix == '\0' || ns->inbox)
+ if ((*ns->prefix == '\0' || ns->inbox) && ctx->match_inbox)
list_flags |= MAILBOX_LIST_INBOX;
ctx->list_ctx = mail_storage_mailbox_list_init(ns->storage,
cur_ref, cur_mask,
More information about the dovecot-cvs
mailing list