dovecot-1.2: LSUB "" %: List namespace prefix if namespace has s...
dovecot at dovecot.org
dovecot at dovecot.org
Mon Oct 5 21:56:57 EEST 2009
details: http://hg.dovecot.org/dovecot-1.2/rev/a0fa514d92f0
changeset: 9409:a0fa514d92f0
user: Timo Sirainen <tss at iki.fi>
date: Mon Oct 05 14:56:51 2009 -0400
description:
LSUB "" %: List namespace prefix if namespace has separate subscriptions.
diffstat:
1 file changed, 18 insertions(+), 5 deletions(-)
src/imap/cmd-list.c | 23 ++++++++++++++++++-----
diffs (51 lines):
diff -r 0c7bbdd7b81f -r a0fa514d92f0 src/imap/cmd-list.c
--- a/src/imap/cmd-list.c Mon Oct 05 14:13:17 2009 -0400
+++ b/src/imap/cmd-list.c Mon Oct 05 14:56:51 2009 -0400
@@ -198,12 +198,16 @@ list_get_inbox_flags(struct cmd_list_con
static bool list_namespace_has_children(struct cmd_list_context *ctx)
{
+ enum mailbox_list_iter_flags list_flags =
+ MAILBOX_LIST_ITER_RETURN_NO_FLAGS;
struct mailbox_list_iterate_context *list_iter;
const struct mailbox_info *info;
bool ret = FALSE;
- list_iter = mailbox_list_iter_init(ctx->ns->list, "%",
- MAILBOX_LIST_ITER_RETURN_NO_FLAGS);
+ if ((ctx->list_flags & MAILBOX_LIST_ITER_SELECT_SUBSCRIBED) != 0)
+ list_flags |= MAILBOX_LIST_ITER_SELECT_SUBSCRIBED;
+
+ list_iter = mailbox_list_iter_init(ctx->ns->list, "%", list_flags);
info = mailbox_list_iter_next(list_iter);
if (info != NULL)
ret = TRUE;
@@ -286,7 +290,8 @@ list_namespace_send_prefix(struct cmd_li
}
}
- if ((ctx->ns->flags & NAMESPACE_FLAG_LIST_CHILDREN) != 0) {
+ if ((ctx->ns->flags & NAMESPACE_FLAG_LIST_CHILDREN) != 0 ||
+ (ctx->list_flags & MAILBOX_LIST_ITER_SELECT_SUBSCRIBED) != 0) {
if (have_children) {
/* children are going to be listed. */
return;
@@ -540,8 +545,16 @@ list_want_send_prefix(struct cmd_list_co
list_want_send_prefix(struct cmd_list_context *ctx, const char *pattern)
{
/* don't send the prefix if we're listing subscribed mailboxes */
- if ((ctx->list_flags & MAILBOX_LIST_ITER_SELECT_SUBSCRIBED) != 0)
- return FALSE;
+ if ((ctx->list_flags & MAILBOX_LIST_ITER_SELECT_SUBSCRIBED) != 0) {
+ if ((ctx->ns->flags & NAMESPACE_FLAG_SUBSCRIPTIONS) == 0) {
+ /* using parent's subscriptions file. it'll handle
+ this internally */
+ return FALSE;
+ }
+ /* send prefix if namespace has at least some subscriptions,
+ but pattern doesn't match any children (e.g. "%") */
+ return TRUE;
+ }
/* send the prefix if namespace is listable. if children are listable
we may or may not need to send it. */
More information about the dovecot-cvs
mailing list