return TRUE;
}
+static int ns_has_child_subscriptions(struct ns_list_iterate_context *ctx,
+ struct mail_namespace *parent_ns)
+{
+ struct mail_namespace *ns;
+
+ for (ns = ctx->namespaces; ns != NULL; ns = ns->next) {
+ if (ns->prefix_len > parent_ns->prefix_len &&
+ strncmp(ns->prefix, parent_ns->prefix,
+ parent_ns->prefix_len) == 0) {
+ if (mailbox_list_iter_subscriptions_refresh(ns->list) < 0)
+ return -1;
+
+ if (mailbox_tree_get_root(ns->list->subscriptions) != NULL)
+ return 1;
+
+ int ret = ns_has_child_subscriptions(ctx, ns);
+ if (ret != 0)
+ return ret;
+ }
+ }
+ return 0;
+}
+
static bool
mailbox_list_ns_prefix_return(struct ns_list_iterate_context *ctx,
struct mail_namespace *ns, bool has_children)
have a child is if one of them is subscribed */
subs_flags = MAILBOX_CHILD_SUBSCRIBED;
}
+ if (subs_flags == 0) {
+ if ((ret = ns_has_child_subscriptions(ctx, ns)) < 0) {
+ mailbox_list_ns_iter_failed(ctx);
+ return FALSE;
+ }
+ if (ret > 0)
+ subs_flags = MAILBOX_CHILD_SUBSCRIBED;
+ }
if (subs_flags != 0 &&
mailbox_list_want_subscription(ns, ctx->ns_info.flags |
subs_flags))
return tree->pool;
}
+struct mailbox_node *mailbox_tree_get_root(struct mailbox_tree_context *tree)
+{
+ return tree->nodes;
+}
+
static struct mailbox_node * ATTR_NULL(2)
mailbox_tree_traverse(struct mailbox_tree_context *tree, const char *path,
bool create, bool *created_r)
void mailbox_tree_set_parents_nonexistent(struct mailbox_tree_context *tree);
void mailbox_tree_clear(struct mailbox_tree_context *tree);
pool_t mailbox_tree_get_pool(struct mailbox_tree_context *tree);
+struct mailbox_node *mailbox_tree_get_root(struct mailbox_tree_context *tree);
struct mailbox_node *
mailbox_tree_get(struct mailbox_tree_context *tree, const char *path,