7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen#ifndef DSYNC_MAILBOX_EXPORT_H
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen#define DSYNC_MAILBOX_EXPORT_H
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainenenum dsync_mailbox_exporter_flags {
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen DSYNC_MAILBOX_EXPORTER_FLAG_AUTO_EXPORT_MAILS = 0x01,
d519a0449d0e536a32db93305516fdbd7db6773dTimo Sirainen DSYNC_MAILBOX_EXPORTER_FLAG_MAILS_HAVE_GUIDS = 0x02,
3561c7bb472a78af74d755219cc0fc71c85ff5c2Timo Sirainen DSYNC_MAILBOX_EXPORTER_FLAG_MINIMAL_DMAIL_FILL = 0x04,
45af47783693b3ba2768c5ad34eeff68132382d0Timo Sirainen DSYNC_MAILBOX_EXPORTER_FLAG_TIMESTAMPS = 0x08,
ae949831f1f668b5501b4b125e7f7b1767fb109bTimo Sirainen DSYNC_MAILBOX_EXPORTER_FLAG_NO_HDR_HASHES = 0x20,
ae949831f1f668b5501b4b125e7f7b1767fb109bTimo Sirainen DSYNC_MAILBOX_EXPORTER_FLAG_VSIZES = 0x40,
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen};
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainenstruct dsync_mailbox_exporter *
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainendsync_mailbox_export_init(struct mailbox *box,
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen struct dsync_transaction_log_scan *log_scan,
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen uint32_t last_common_uid,
f3c24c2c92802cb773315eba1132254932d8709bTimo Sirainen enum dsync_mailbox_exporter_flags flags,
69a71891361b2b27ff68ed84b29278486628464aAki Tuomi unsigned int hdr_hash_version,
69a71891361b2b27ff68ed84b29278486628464aAki Tuomi const char *const *hashed_headers);
e1bef591ed45c5baf6b5bdc69fb7fa5ff05df2b6Timo Sirainen/* Returns 1 if attribute was returned, 0 if no more attributes, -1 on error */
e1bef591ed45c5baf6b5bdc69fb7fa5ff05df2b6Timo Sirainenint dsync_mailbox_export_next_attr(struct dsync_mailbox_exporter *exporter,
e1bef591ed45c5baf6b5bdc69fb7fa5ff05df2b6Timo Sirainen const struct dsync_mailbox_attribute **attr_r);
e1bef591ed45c5baf6b5bdc69fb7fa5ff05df2b6Timo Sirainen/* Returns 1 if change was returned, 0 if no more changes, -1 on error */
e1bef591ed45c5baf6b5bdc69fb7fa5ff05df2b6Timo Sirainenint dsync_mailbox_export_next(struct dsync_mailbox_exporter *exporter,
e1bef591ed45c5baf6b5bdc69fb7fa5ff05df2b6Timo Sirainen const struct dsync_mail_change **change_r);
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainenvoid dsync_mailbox_export_want_mail(struct dsync_mailbox_exporter *exporter,
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen const struct dsync_mail_request *request);
e1bef591ed45c5baf6b5bdc69fb7fa5ff05df2b6Timo Sirainen/* Returns 1 if mail was returned, 0 if no more mails, -1 on error */
e1bef591ed45c5baf6b5bdc69fb7fa5ff05df2b6Timo Sirainenint dsync_mailbox_export_next_mail(struct dsync_mailbox_exporter *exporter,
e1bef591ed45c5baf6b5bdc69fb7fa5ff05df2b6Timo Sirainen const struct dsync_mail **mail_r);
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainenint dsync_mailbox_export_deinit(struct dsync_mailbox_exporter **exporter,
ce0e25f26d6e67480ee39b5ca0ad634fa60c4605Timo Sirainen const char **errstr_r, enum mail_error *error_r);
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen
47255691575e06a1c95ce78ff0a1b502199de3abTimo Sirainenconst char *dsync_mailbox_export_get_proctitle(struct dsync_mailbox_exporter *exporter);
47255691575e06a1c95ce78ff0a1b502199de3abTimo Sirainen
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen#endif