summaryrefslogtreecommitdiffstats
path: root/src/lib-storage/list/mailbox-list-iter-private.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 09:51:24 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 09:51:24 +0000
commitf7548d6d28c313cf80e6f3ef89aed16a19815df1 (patch)
treea3f6f2a3f247293bee59ecd28e8cd8ceb6ca064a /src/lib-storage/list/mailbox-list-iter-private.h
parentInitial commit. (diff)
downloaddovecot-upstream.tar.xz
dovecot-upstream.zip
Adding upstream version 1:2.3.19.1+dfsg1.upstream/1%2.3.19.1+dfsg1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/lib-storage/list/mailbox-list-iter-private.h')
-rw-r--r--src/lib-storage/list/mailbox-list-iter-private.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/lib-storage/list/mailbox-list-iter-private.h b/src/lib-storage/list/mailbox-list-iter-private.h
new file mode 100644
index 0000000..47de2ce
--- /dev/null
+++ b/src/lib-storage/list/mailbox-list-iter-private.h
@@ -0,0 +1,42 @@
+#ifndef MAILBOX_LIST_ITER_PRIVATE_H
+#define MAILBOX_LIST_ITER_PRIVATE_H
+
+#include "mailbox-list-private.h"
+#include "mailbox-list-iter.h"
+#include "mailbox-list-delete.h"
+
+struct autocreate_box {
+ const char *name;
+ const struct mailbox_settings *set;
+ enum mailbox_info_flags flags;
+ bool child_listed;
+};
+
+ARRAY_DEFINE_TYPE(mailbox_settings, struct mailbox_settings *);
+struct mailbox_list_autocreate_iterate_context {
+ unsigned int idx;
+ struct mailbox_info new_info;
+ ARRAY(struct autocreate_box) boxes;
+ ARRAY_TYPE(mailbox_settings) box_sets;
+ ARRAY_TYPE(mailbox_settings) all_ns_box_sets;
+ HASH_TABLE(char *, char *) duplicate_vnames;
+ bool listing_autoboxes:1;
+};
+
+static inline bool
+mailbox_list_iter_try_delete_noselect(struct mailbox_list_iterate_context *ctx,
+ const struct mailbox_info *info,
+ const char *storage_name)
+{
+ if ((info->flags & (MAILBOX_NOSELECT|MAILBOX_NOCHILDREN)) ==
+ (MAILBOX_NOSELECT|MAILBOX_NOCHILDREN) &&
+ ctx->list->set.no_noselect) {
+ /* Try to rmdir() all \NoSelect mailbox leafs and
+ afterwards their parents. */
+ mailbox_list_delete_mailbox_until_root(ctx->list, storage_name);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+#endif