90de49eb151c2be7655ce6aef5aa3b58295d5c84Timo Sirainen#ifndef IMAPC_LIST_H
90de49eb151c2be7655ce6aef5aa3b58295d5c84Timo Sirainen#define IMAPC_LIST_H
90de49eb151c2be7655ce6aef5aa3b58295d5c84Timo Sirainen
90de49eb151c2be7655ce6aef5aa3b58295d5c84Timo Sirainenstruct imap_arg;
90de49eb151c2be7655ce6aef5aa3b58295d5c84Timo Sirainen
90de49eb151c2be7655ce6aef5aa3b58295d5c84Timo Sirainen#include "mailbox-list-private.h"
90de49eb151c2be7655ce6aef5aa3b58295d5c84Timo Sirainen
90de49eb151c2be7655ce6aef5aa3b58295d5c84Timo Sirainen#define MAILBOX_LIST_NAME_IMAPC "imapc"
90de49eb151c2be7655ce6aef5aa3b58295d5c84Timo Sirainen
90de49eb151c2be7655ce6aef5aa3b58295d5c84Timo Sirainenstruct imapc_mailbox_list {
90de49eb151c2be7655ce6aef5aa3b58295d5c84Timo Sirainen struct mailbox_list list;
9bc29938d8df24e64db865cba3b03d6c6cd95237Timo Sirainen const struct imapc_settings *set;
8e1dbcb9b249c37d00b420705777b103ffa6145dTimo Sirainen struct imapc_storage_client *client;
d83e46e7cd1ffd76210823dadcac549124c96d4eTimo Sirainen struct mailbox_list *index_list;
90de49eb151c2be7655ce6aef5aa3b58295d5c84Timo Sirainen
f97b503210435b74de3b26cba07315cbc9ea1dfcTimo Sirainen /* mailboxes are stored as vnames */
31277bf6e9bdfec5c72739a95b6885b52a64deacTimo Sirainen struct mailbox_tree_context *mailboxes, *tmp_subscriptions;
8e1dbcb9b249c37d00b420705777b103ffa6145dTimo Sirainen char root_sep;
7586eb9be41bf2de90790ab1c50ba6bfb85402b4Timo Sirainen time_t last_refreshed_mailboxes;
90de49eb151c2be7655ce6aef5aa3b58295d5c84Timo Sirainen
31277bf6e9bdfec5c72739a95b6885b52a64deacTimo Sirainen unsigned int iter_count;
31277bf6e9bdfec5c72739a95b6885b52a64deacTimo Sirainen
7586eb9be41bf2de90790ab1c50ba6bfb85402b4Timo Sirainen /* mailboxes/subscriptions are fully refreshed only during
7586eb9be41bf2de90790ab1c50ba6bfb85402b4Timo Sirainen mailbox list iteration. */
0dffa25d211be541ee3c953b23566a1a990789dfTimo Sirainen bool refreshed_subscriptions:1;
0dffa25d211be541ee3c953b23566a1a990789dfTimo Sirainen bool refreshed_mailboxes:1;
7586eb9be41bf2de90790ab1c50ba6bfb85402b4Timo Sirainen /* mailbox list's "recently refreshed" state is reset by syncing a
7586eb9be41bf2de90790ab1c50ba6bfb85402b4Timo Sirainen mailbox. mainly we use this to cache mailboxes' existence to avoid
7586eb9be41bf2de90790ab1c50ba6bfb85402b4Timo Sirainen issuing a LIST command every time. */
0dffa25d211be541ee3c953b23566a1a990789dfTimo Sirainen bool refreshed_mailboxes_recently:1;
0dffa25d211be541ee3c953b23566a1a990789dfTimo Sirainen bool index_list_failed:1;
0dffa25d211be541ee3c953b23566a1a990789dfTimo Sirainen bool root_sep_pending:1;
90de49eb151c2be7655ce6aef5aa3b58295d5c84Timo Sirainen};
90de49eb151c2be7655ce6aef5aa3b58295d5c84Timo Sirainen
1228c0604b8e21e170bba3e2060331599a378110Timo Sirainenint imapc_list_get_mailbox_flags(struct mailbox_list *list, const char *name,
1228c0604b8e21e170bba3e2060331599a378110Timo Sirainen enum mailbox_info_flags *flags_r);
8e1dbcb9b249c37d00b420705777b103ffa6145dTimo Sirainenint imapc_list_try_get_root_sep(struct imapc_mailbox_list *list, char *sep_r);
f97b503210435b74de3b26cba07315cbc9ea1dfcTimo Sirainenconst char *imapc_list_to_remote(struct imapc_mailbox_list *list, const char *name);
90de49eb151c2be7655ce6aef5aa3b58295d5c84Timo Sirainen
90de49eb151c2be7655ce6aef5aa3b58295d5c84Timo Sirainen#endif