mbox-sync-private.h revision 0dffa25d211be541ee3c953b23566a1a990789df
#ifndef MBOX_SYNC_PRIVATE_H
#define MBOX_SYNC_PRIVATE_H
#include "md5.h"
#include "mail-index.h"
enum mbox_sync_flags {
MBOX_SYNC_HEADER = 0x02,
MBOX_SYNC_LOCK_READING = 0x04,
MBOX_SYNC_UNDIRTY = 0x08,
MBOX_SYNC_REWRITE = 0x10,
MBOX_SYNC_FORCE_SYNC = 0x20,
MBOX_SYNC_READONLY = 0x40
};
struct mbox_flag_type {
char chr;
enum mail_flags flag;
};
enum header_position {
};
/* kludgy. swap MAIL_RECENT with MBOX_NONRECENT_KLUDGE when writing Status
header, because 'O' flag means non-recent but internally we want to use
recent flag. */
#define MBOX_NONRECENT_KLUDGE MAIL_RECENT
extern struct mbox_flag_type mbox_status_flags[];
extern struct mbox_flag_type mbox_xstatus_flags[];
struct mbox_sync_mail {
/* uid=0 can mean that this mail describes an expunged area or that
this is a pseudo message */
bool uid_broken:1;
bool expunged:1;
bool pseudo:1;
bool status_broken:1;
bool xstatus_broken:1;
/* following variables have a bit overloaded functionality:
a) space <= 0 : offset points to beginning of headers. space is the
amount of space missing that is required to be able to rewrite
the headers
b) space > 0 : offset points to beginning of whitespace that can
be removed. space is the amount of data that can be removed from
there. note that the message may contain more whitespace
elsewhere. */
};
struct mbox_sync_mail_context {
struct mbox_sync_context *sync_ctx;
struct mbox_sync_mail mail;
unsigned char hdr_md5_sum[16];
unsigned int last_uid_value_start_pos;
bool have_eoh:1;
bool need_rewrite:1;
bool seen_imapbase:1;
bool updated:1;
bool recent:1;
bool dirty:1;
bool imapbase_rewrite:1;
bool imapbase_updated:1;
};
struct mbox_sync_context {
struct mbox_mailbox *mbox;
enum mbox_sync_flags flags;
int write_fd;
struct mail_index_sync_ctx *index_sync_ctx;
struct mail_index_view *sync_view;
struct mail_index_transaction *t;
struct mail_index_header reset_hdr;
const struct mail_index_header *hdr;
/* header state: */
/* mail state: */
struct index_sync_changes_context *sync_changes;
/* per-mail pool */
/* used for mails[].keywords */
bool dest_first_mail:1;
bool first_mail_crlf_expunged:1;
/* global flags: */
bool keep_recent:1;
bool readonly:1;
bool delay_writes:1;
bool renumber_uids:1;
bool moved_offsets:1;
bool ext_modified:1;
bool index_reset:1;
bool errors:1;
};
bool *empty_r);
struct mbox_sync_mail_context *ctx);
const struct mbox_sync_mail *mail);
struct mbox_sync_mail_context *mail_ctx,
struct mail_index_view *list_view,
struct mail_index_transaction *trans,
#endif