imap-thread.h revision 24e3b6aee28a8fb126e1f21348cc80acb2338518
5f5870385cff47efd2f58e7892f251cf13761528Timo Sirainen#ifndef IMAP_THREAD_H
ecc81625167ed96c04c02aa190a1ea5baa65b474Timo Sirainen#define IMAP_THREAD_H
ecc81625167ed96c04c02aa190a1ea5baa65b474Timo Sirainen
07e4875d250e7a7157cd99132aafc773cf3cdf83Timo Sirainenstruct imap_thread_context;
e0c3d5460d1cc0c440cb7723c8c2eef8d0afe9b9Timo Sirainen
0536ccb51d41e3078c3a9fa33e509fb4b2420f95Timo Sirainenenum mail_thread_type {
ecc81625167ed96c04c02aa190a1ea5baa65b474Timo Sirainen MAIL_THREAD_NONE,
8cb72c59d5ea4e9e5f638d7ec840bb853f5a188eTimo Sirainen MAIL_THREAD_ORDEREDSUBJECT,
8cb72c59d5ea4e9e5f638d7ec840bb853f5a188eTimo Sirainen MAIL_THREAD_REFERENCES,
8cb72c59d5ea4e9e5f638d7ec840bb853f5a188eTimo Sirainen MAIL_THREAD_REFERENCES2
8cb72c59d5ea4e9e5f638d7ec840bb853f5a188eTimo Sirainen};
8cb72c59d5ea4e9e5f638d7ec840bb853f5a188eTimo Sirainen
8cb72c59d5ea4e9e5f638d7ec840bb853f5a188eTimo Sirainenstruct mail_thread_child_node {
8cb72c59d5ea4e9e5f638d7ec840bb853f5a188eTimo Sirainen uint32_t idx;
8cb72c59d5ea4e9e5f638d7ec840bb853f5a188eTimo Sirainen uint32_t uid;
8cb72c59d5ea4e9e5f638d7ec840bb853f5a188eTimo Sirainen time_t sort_date;
8cb72c59d5ea4e9e5f638d7ec840bb853f5a188eTimo Sirainen};
8cb72c59d5ea4e9e5f638d7ec840bb853f5a188eTimo SirainenARRAY_DEFINE_TYPE(mail_thread_child_node, struct mail_thread_child_node);
8cb72c59d5ea4e9e5f638d7ec840bb853f5a188eTimo Sirainen
8cb72c59d5ea4e9e5f638d7ec840bb853f5a188eTimo Sirainenint imap_thread_init(struct mailbox *box, bool reset,
8cb72c59d5ea4e9e5f638d7ec840bb853f5a188eTimo Sirainen struct mail_search_args *args,
8cb72c59d5ea4e9e5f638d7ec840bb853f5a188eTimo Sirainen struct imap_thread_context **ctx_r);
8cb72c59d5ea4e9e5f638d7ec840bb853f5a188eTimo Sirainenvoid imap_thread_deinit(struct imap_thread_context **ctx);
cd56a23e21f1df3f79648cf07e2f4385e2fadebbTimo Sirainen
cd56a23e21f1df3f79648cf07e2f4385e2fadebbTimo Sirainenstruct mail_thread_iterate_context *
cd56a23e21f1df3f79648cf07e2f4385e2fadebbTimo Sirainenimap_thread_iterate_init(struct imap_thread_context *ctx,
cd56a23e21f1df3f79648cf07e2f4385e2fadebbTimo Sirainen enum mail_thread_type thread_type, bool write_seqs);
cd56a23e21f1df3f79648cf07e2f4385e2fadebbTimo Sirainenconst struct mail_thread_child_node *
cd56a23e21f1df3f79648cf07e2f4385e2fadebbTimo Sirainenmail_thread_iterate_next(struct mail_thread_iterate_context *iter,
c0435c854a0e7246373b9752d163095cc4fbe985Timo Sirainen struct mail_thread_iterate_context **child_iter_r);
ecc81625167ed96c04c02aa190a1ea5baa65b474Timo Sirainenunsigned int
252db51b6c0a605163326b3ea5d09e9936ca3b29Timo Sirainenmail_thread_iterate_count(struct mail_thread_iterate_context *iter);
ecc81625167ed96c04c02aa190a1ea5baa65b474Timo Sirainenint mail_thread_iterate_deinit(struct mail_thread_iterate_context **iter);
ecc81625167ed96c04c02aa190a1ea5baa65b474Timo Sirainen
d5cebe7f98e63d4e2822863ef2faa4971e8b3a5dTimo Sirainenvoid imap_threads_init(void);
ecc81625167ed96c04c02aa190a1ea5baa65b474Timo Sirainenvoid imap_threads_deinit(void);
252db51b6c0a605163326b3ea5d09e9936ca3b29Timo Sirainen
e0c3d5460d1cc0c440cb7723c8c2eef8d0afe9b9Timo Sirainen#endif
e0c3d5460d1cc0c440cb7723c8c2eef8d0afe9b9Timo Sirainen