dovecot-2.2: imap: Fixed LIST (SPECIAL-USE RECURSIVEMATCH) to ac...
dovecot at dovecot.org
dovecot at dovecot.org
Tue Sep 4 16:23:48 EEST 2012
details: http://hg.dovecot.org/dovecot-2.2/rev/169385092bae
changeset: 15020:169385092bae
user: Timo Sirainen <tss at iki.fi>
date: Tue Sep 04 16:22:14 2012 +0300
description:
imap: Fixed LIST (SPECIAL-USE RECURSIVEMATCH) to actually return CHILDINFOs.
diffstat:
src/lib-storage/list/mailbox-list-iter.c | 9 +++++++++
src/lib-storage/mail-namespace.c | 16 ++++++++++++++++
src/lib-storage/mail-namespace.h | 1 +
src/lib-storage/mailbox-list.h | 1 +
4 files changed, 27 insertions(+), 0 deletions(-)
diffs (81 lines):
diff -r 46d972c228c0 -r 169385092bae src/lib-storage/list/mailbox-list-iter.c
--- a/src/lib-storage/list/mailbox-list-iter.c Tue Sep 04 16:06:29 2012 +0300
+++ b/src/lib-storage/list/mailbox-list-iter.c Tue Sep 04 16:22:14 2012 +0300
@@ -444,6 +444,8 @@
ctx->ns_info.ns = ns;
ctx->ns_info.vname = p_strndup(ctx->pool, ns->prefix,
ns->prefix_len-1);
+ if (ns->special_use_mailboxes)
+ ctx->ns_info.flags |= MAILBOX_CHILD_SPECIALUSE;
if (strcasecmp(ctx->ns_info.vname, "INBOX") == 0) {
i_assert(!ctx->inbox_listed);
@@ -972,6 +974,13 @@
special_use_selection(struct mailbox_list_iterate_context *ctx,
const struct mailbox_info *info)
{
+ if ((ctx->flags & MAILBOX_LIST_ITER_SELECT_RECURSIVEMATCH) != 0 &&
+ (ctx->flags & MAILBOX_LIST_ITER_SELECT_SPECIALUSE) != 0) {
+ /* LIST (SPECIAL-USE RECURSIVEMATCH) used. for now we support
+ this only for namespace prefixes */
+ if ((info->flags & MAILBOX_CHILD_SPECIALUSE) != 0)
+ return TRUE;
+ }
return (ctx->flags & MAILBOX_LIST_ITER_SELECT_SPECIALUSE) == 0 ||
info->special_use != NULL;
}
diff -r 46d972c228c0 -r 169385092bae src/lib-storage/mail-namespace.c
--- a/src/lib-storage/mail-namespace.c Tue Sep 04 16:06:29 2012 +0300
+++ b/src/lib-storage/mail-namespace.c Tue Sep 04 16:22:14 2012 +0300
@@ -44,6 +44,21 @@
i_free(ns);
}
+static bool
+namespace_has_special_use_mailboxes(struct mail_namespace_settings *ns_set)
+{
+ struct mailbox_settings *const *box_set;
+
+ if (!array_is_created(&ns_set->mailboxes))
+ return FALSE;
+
+ array_foreach(&ns_set->mailboxes, box_set) {
+ if ((*box_set)->special_use[0] != '\0')
+ return TRUE;
+ }
+ return FALSE;
+}
+
static int
namespace_add(struct mail_user *user,
struct mail_namespace_settings *ns_set,
@@ -110,6 +125,7 @@
ns->unexpanded_set = unexpanded_ns_set;
ns->mail_set = mail_set;
ns->prefix = i_strdup(ns_set->prefix);
+ ns->special_use_mailboxes = namespace_has_special_use_mailboxes(ns_set);
if (ns->type == MAIL_NAMESPACE_TYPE_SHARED &&
(strchr(ns->prefix, '%') != NULL ||
diff -r 46d972c228c0 -r 169385092bae src/lib-storage/mail-namespace.h
--- a/src/lib-storage/mail-namespace.h Tue Sep 04 16:06:29 2012 +0300
+++ b/src/lib-storage/mail-namespace.h Tue Sep 04 16:22:14 2012 +0300
@@ -73,6 +73,7 @@
struct mail_namespace_settings *set, *unexpanded_set;
const struct mail_storage_settings *mail_set;
+ unsigned int special_use_mailboxes:1;
unsigned int destroyed:1;
};
diff -r 46d972c228c0 -r 169385092bae src/lib-storage/mailbox-list.h
--- a/src/lib-storage/mailbox-list.h Tue Sep 04 16:06:29 2012 +0300
+++ b/src/lib-storage/mailbox-list.h Tue Sep 04 16:22:14 2012 +0300
@@ -47,6 +47,7 @@
MAILBOX_UNMARKED = 0x040,
MAILBOX_SUBSCRIBED = 0x080,
MAILBOX_CHILD_SUBSCRIBED = 0x100,
+ MAILBOX_CHILD_SPECIALUSE = 0x200,
/* Internally used by lib-storage */
MAILBOX_SELECT = 0x20000000,
More information about the dovecot-cvs
mailing list