diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 09:51:24 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 09:51:24 +0000 |
commit | f7548d6d28c313cf80e6f3ef89aed16a19815df1 (patch) | |
tree | a3f6f2a3f247293bee59ecd28e8cd8ceb6ca064a /src/lib-storage/mail-thread.h | |
parent | Initial commit. (diff) | |
download | dovecot-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/mail-thread.h')
-rw-r--r-- | src/lib-storage/mail-thread.h | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/src/lib-storage/mail-thread.h b/src/lib-storage/mail-thread.h new file mode 100644 index 0000000..fb2e5ed --- /dev/null +++ b/src/lib-storage/mail-thread.h @@ -0,0 +1,54 @@ +#ifndef MAIL_THREAD_H +#define MAIL_THREAD_H + +struct mailbox; +struct mail_search_args; +struct mail_thread_context; + +enum mail_thread_type { + MAIL_THREAD_NONE, + MAIL_THREAD_ORDEREDSUBJECT, + MAIL_THREAD_REFERENCES, + MAIL_THREAD_REFS +}; + +struct mail_thread_child_node { + /* Node's index in mail hash transaction */ + uint32_t idx; + /* UID or sequence */ + uint32_t uid; + /* Timestamp node was sorted with (depends on thread algorithm) */ + time_t sort_date; +}; +ARRAY_DEFINE_TYPE(mail_thread_child_node, struct mail_thread_child_node); + +/* Convert thread type string to enum. Returns TRUE if ok, FALSE if type is + unknown. */ +bool mail_thread_type_parse(const char *str, enum mail_thread_type *type_r); +/* Return thread type as string. */ +const char *mail_thread_type_to_str(enum mail_thread_type type); + +/* Build thread from given search arguments. args=NULL searches everything. */ +int mail_thread_init(struct mailbox *box, struct mail_search_args *args, + struct mail_thread_context **ctx_r) ATTR_NULL(2); +void mail_thread_deinit(struct mail_thread_context **ctx); + +/* Iterate through thread tree. If write_seqs=TRUE, sequences are returned in + mail_thread_child_node.uid instead of UIDs. */ +struct mail_thread_iterate_context * +mail_thread_iterate_init(struct mail_thread_context *ctx, + enum mail_thread_type thread_type, bool write_seqs); +/* If child_iter_r is not NULL, it's set to contain another iterator if the + returned node contains children. The returned iterator must be freed + explicitly. */ +const struct mail_thread_child_node * +mail_thread_iterate_next(struct mail_thread_iterate_context *iter, + struct mail_thread_iterate_context **child_iter_r); +/* Returns number of nodes in the current iterator. */ +unsigned int +mail_thread_iterate_count(struct mail_thread_iterate_context *iter); +/* Free the iterator. Iterators don't reference other iterators, so it doesn't + matter in which order they're freed. */ +int mail_thread_iterate_deinit(struct mail_thread_iterate_context **iter); + +#endif |