summaryrefslogtreecommitdiffstats
path: root/src/lib-storage/mailbox-tree.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/mailbox-tree.h
parentInitial commit. (diff)
downloaddovecot-f7548d6d28c313cf80e6f3ef89aed16a19815df1.tar.xz
dovecot-f7548d6d28c313cf80e6f3ef89aed16a19815df1.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/mailbox-tree.h')
-rw-r--r--src/lib-storage/mailbox-tree.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/lib-storage/mailbox-tree.h b/src/lib-storage/mailbox-tree.h
new file mode 100644
index 0000000..aeb45c4
--- /dev/null
+++ b/src/lib-storage/mailbox-tree.h
@@ -0,0 +1,45 @@
+#ifndef MAILBOX_TREE_H
+#define MAILBOX_TREE_H
+
+#include "mailbox-list.h"
+
+struct mailbox_node {
+ struct mailbox_node *parent;
+ struct mailbox_node *next;
+ struct mailbox_node *children;
+
+ char *name;
+ enum mailbox_info_flags flags;
+};
+ARRAY_DEFINE_TYPE(mailbox_node, struct mailbox_node *);
+
+struct mailbox_tree_context *mailbox_tree_init(char separator);
+struct mailbox_tree_context *
+mailbox_tree_init_size(char separator, unsigned int mailbox_node_size);
+void mailbox_tree_deinit(struct mailbox_tree_context **tree);
+
+void mailbox_tree_set_separator(struct mailbox_tree_context *tree,
+ char separator);
+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(struct mailbox_tree_context *tree, const char *path,
+ bool *created_r);
+
+struct mailbox_node *
+mailbox_tree_lookup(struct mailbox_tree_context *tree, const char *path);
+
+struct mailbox_tree_iterate_context * ATTR_NULL(2)
+mailbox_tree_iterate_init(struct mailbox_tree_context *tree,
+ struct mailbox_node *root, unsigned int flags_mask);
+struct mailbox_node *
+mailbox_tree_iterate_next(struct mailbox_tree_iterate_context *ctx,
+ const char **path_r);
+void mailbox_tree_iterate_deinit(struct mailbox_tree_iterate_context **ctx);
+
+struct mailbox_tree_context *mailbox_tree_dup(struct mailbox_tree_context *src);
+void mailbox_tree_sort(struct mailbox_tree_context *tree);
+
+#endif