9fb018dea4e2073639249ea8a14ae27cab2c0aacTimo Sirainen#ifndef CYDIR_SYNC_H
9fb018dea4e2073639249ea8a14ae27cab2c0aacTimo Sirainen#define CYDIR_SYNC_H
9fb018dea4e2073639249ea8a14ae27cab2c0aacTimo Sirainen
9fb018dea4e2073639249ea8a14ae27cab2c0aacTimo Sirainenstruct mailbox;
d83e46e7cd1ffd76210823dadcac549124c96d4eTimo Sirainenstruct mailbox_sync_status;
9fb018dea4e2073639249ea8a14ae27cab2c0aacTimo Sirainen
635f1b145fa159d7de55aaf527c904f071667e0bTimo Sirainenstruct imapc_sync_store {
635f1b145fa159d7de55aaf527c904f071667e0bTimo Sirainen enum modify_type modify_type;
635f1b145fa159d7de55aaf527c904f071667e0bTimo Sirainen const char *flags;
635f1b145fa159d7de55aaf527c904f071667e0bTimo Sirainen
635f1b145fa159d7de55aaf527c904f071667e0bTimo Sirainen ARRAY_TYPE(seq_range) uids;
635f1b145fa159d7de55aaf527c904f071667e0bTimo Sirainen};
635f1b145fa159d7de55aaf527c904f071667e0bTimo Sirainen
9fb018dea4e2073639249ea8a14ae27cab2c0aacTimo Sirainenstruct imapc_sync_context {
9fb018dea4e2073639249ea8a14ae27cab2c0aacTimo Sirainen struct imapc_mailbox *mbox;
9fb018dea4e2073639249ea8a14ae27cab2c0aacTimo Sirainen struct mail_index_sync_ctx *index_sync_ctx;
9fb018dea4e2073639249ea8a14ae27cab2c0aacTimo Sirainen struct mail_index_view *sync_view;
9fb018dea4e2073639249ea8a14ae27cab2c0aacTimo Sirainen struct mail_index_transaction *trans;
934dbb10a198c803485b683911777888aeeaceebTimo Sirainen
934dbb10a198c803485b683911777888aeeaceebTimo Sirainen const ARRAY_TYPE(keywords) *keywords;
934dbb10a198c803485b683911777888aeeaceebTimo Sirainen ARRAY_TYPE(seq_range) expunged_uids;
934dbb10a198c803485b683911777888aeeaceebTimo Sirainen unsigned int sync_command_count;
df48643c3c240ad5b8a3e2e2132c46f7dc541b5eTimo Sirainen
635f1b145fa159d7de55aaf527c904f071667e0bTimo Sirainen pool_t pool;
635f1b145fa159d7de55aaf527c904f071667e0bTimo Sirainen HASH_TABLE(struct imapc_sync_store *, struct imapc_sync_store *) stores;
635f1b145fa159d7de55aaf527c904f071667e0bTimo Sirainen
635f1b145fa159d7de55aaf527c904f071667e0bTimo Sirainen uint32_t prev_uid1, prev_uid2;
635f1b145fa159d7de55aaf527c904f071667e0bTimo Sirainen enum modify_type prev_modify_type;
635f1b145fa159d7de55aaf527c904f071667e0bTimo Sirainen string_t *prev_flags;
635f1b145fa159d7de55aaf527c904f071667e0bTimo Sirainen
0dffa25d211be541ee3c953b23566a1a990789dfTimo Sirainen bool failed:1;
9fb018dea4e2073639249ea8a14ae27cab2c0aacTimo Sirainen};
9fb018dea4e2073639249ea8a14ae27cab2c0aacTimo Sirainen
9fb018dea4e2073639249ea8a14ae27cab2c0aacTimo Sirainenstruct mailbox_sync_context *
9fb018dea4e2073639249ea8a14ae27cab2c0aacTimo Sirainenimapc_mailbox_sync_init(struct mailbox *box, enum mailbox_sync_flags flags);
9fb018dea4e2073639249ea8a14ae27cab2c0aacTimo Sirainenint imapc_mailbox_sync_deinit(struct mailbox_sync_context *ctx,
9fb018dea4e2073639249ea8a14ae27cab2c0aacTimo Sirainen struct mailbox_sync_status *status_r);
9fb018dea4e2073639249ea8a14ae27cab2c0aacTimo Sirainen
9fb018dea4e2073639249ea8a14ae27cab2c0aacTimo Sirainen#endif