mbox-sync-private.h revision f140f88a5ab3e2194f214c11f9f418559e949c83
a27e065f1a1f91c7fbdf7c2ea1c387441af0cbb3Timo Sirainen/* kludgy. swap MAIL_RECENT with MBOX_NONRECENT_KLUDGE when writing Status
8e371a3ce32bd64288786855b8ce0cb63f19f7d1Timo Sirainen header, because 'O' flag means non-recent but internally we want to use
220e21750948941dc6e33b8f11b552fa21d7f81eTimo Sirainen recent flag. */
8a0ad174adb1eb5108511b90e97f4e5f9089b0eeTimo Sirainen#define STATUS_FLAGS_MASK (MAIL_SEEN|MBOX_NONRECENT_KLUDGE)
8a0ad174adb1eb5108511b90e97f4e5f9089b0eeTimo Sirainen#define XSTATUS_FLAGS_MASK (MAIL_ANSWERED|MAIL_FLAGGED|MAIL_DRAFT|MAIL_DELETED)
8a0ad174adb1eb5108511b90e97f4e5f9089b0eeTimo Sirainenextern struct mbox_flag_type mbox_status_flags[];
8a0ad174adb1eb5108511b90e97f4e5f9089b0eeTimo Sirainenextern struct mbox_flag_type mbox_xstatus_flags[];
8a0ad174adb1eb5108511b90e97f4e5f9089b0eeTimo Sirainen /* uid=0 can mean that this mail describes an expunged area or that
8a0ad174adb1eb5108511b90e97f4e5f9089b0eeTimo Sirainen this is a pseudo message */
a27e065f1a1f91c7fbdf7c2ea1c387441af0cbb3Timo Sirainen /* following variables have a bit overloaded functionality:
a27e065f1a1f91c7fbdf7c2ea1c387441af0cbb3Timo Sirainen a) space <= 0 : offset points to beginning of headers. space is the
a27e065f1a1f91c7fbdf7c2ea1c387441af0cbb3Timo Sirainen amount of space missing that is required to be able to rewrite
a27e065f1a1f91c7fbdf7c2ea1c387441af0cbb3Timo Sirainen b) space > 0 : offset points to beginning of whitespace that can
8a0ad174adb1eb5108511b90e97f4e5f9089b0eeTimo Sirainen be removed. space is the amount of data that can be removed from
8a0ad174adb1eb5108511b90e97f4e5f9089b0eeTimo Sirainen there. note that the message may contain more whitespace
8a0ad174adb1eb5108511b90e97f4e5f9089b0eeTimo Sirainen elsewhere. */
a27e065f1a1f91c7fbdf7c2ea1c387441af0cbb3Timo Sirainen size_t header_first_change, header_last_change;
1701e3f91107051b1704721bf1dc1e32491faaf9Timo Sirainen /* header state: */
2649b237dd4690575e75a30b2bf3b39ebd37b835Timo Sirainen /* mail state: */
2649b237dd4690575e75a30b2bf3b39ebd37b835Timo Sirainen struct index_sync_changes_context *sync_changes;
2649b237dd4690575e75a30b2bf3b39ebd37b835Timo Sirainen /* per-mail pool */
2649b237dd4690575e75a30b2bf3b39ebd37b835Timo Sirainen /* used for mails[].keywords */
a24519c36d5f8fa22f58b2c693ba547e8d175a54Timo Sirainen uint32_t prev_msg_uid, next_uid, idx_next_uid;
2615df45a8027948a474abe5e817b34b0499c171Timo Sirainen /* global flags: */
2a6dcd984104fed84bed8795ccdfabb20e41ce52Timo Sirainenint mbox_sync_header_refresh(struct mbox_mailbox *mbox);
2a6dcd984104fed84bed8795ccdfabb20e41ce52Timo Sirainenint mbox_sync(struct mbox_mailbox *mbox, enum mbox_sync_flags flags);
2a6dcd984104fed84bed8795ccdfabb20e41ce52Timo Sirainenint mbox_sync_has_changed(struct mbox_mailbox *mbox, bool leave_dirty);
2a6dcd984104fed84bed8795ccdfabb20e41ce52Timo Sirainenint mbox_sync_has_changed_full(struct mbox_mailbox *mbox, bool leave_dirty,
2615df45a8027948a474abe5e817b34b0499c171Timo Sirainenvoid mbox_sync_set_critical(struct mbox_sync_context *sync_ctx,
2649b237dd4690575e75a30b2bf3b39ebd37b835Timo Sirainenvoid mbox_sync_parse_next_mail(struct istream *input,
2615df45a8027948a474abe5e817b34b0499c171Timo Sirainenbool mbox_sync_parse_match_mail(struct mbox_mailbox *mbox,
2615df45a8027948a474abe5e817b34b0499c171Timo Sirainenvoid mbox_sync_update_header(struct mbox_sync_mail_context *ctx);
2615df45a8027948a474abe5e817b34b0499c171Timo Sirainenvoid mbox_sync_update_header_from(struct mbox_sync_mail_context *ctx,
2615df45a8027948a474abe5e817b34b0499c171Timo Sirainenint mbox_sync_try_rewrite(struct mbox_sync_mail_context *ctx, off_t move_diff);
2615df45a8027948a474abe5e817b34b0499c171Timo Sirainenint mbox_sync_rewrite(struct mbox_sync_context *sync_ctx,
2615df45a8027948a474abe5e817b34b0499c171Timo Sirainen uoff_t end_offset, off_t move_diff, uoff_t extra_space,
2615df45a8027948a474abe5e817b34b0499c171Timo Sirainenint mbox_sync_seek(struct mbox_sync_context *sync_ctx, uoff_t from_offset);
1c1cecd3dfaf71b0c9499b044023e631841e88aaTimo Sirainenvoid mbox_sync_file_update_ext_modified(struct mbox_sync_context *sync_ctx);
2615df45a8027948a474abe5e817b34b0499c171Timo Sirainenvoid mbox_sync_file_updated(struct mbox_sync_context *sync_ctx, bool dirty);
2615df45a8027948a474abe5e817b34b0499c171Timo Sirainenint mbox_move(struct mbox_sync_context *sync_ctx,
e5acc283bf030b0b5c79ca4e52d315c516a299faPascal Volkvoid mbox_sync_move_buffer(struct mbox_sync_mail_context *ctx,