4
#include "mail-storage.h"
7
uint8_t guid[MAIL_GUID_128_SIZE];
9
ARRAY_DEFINE_TYPE(mailbox_guid, mailbox_guid_t);
11
enum dsync_mailbox_flags {
12
DSYNC_MAILBOX_FLAG_NOSELECT = 0x01,
13
DSYNC_MAILBOX_FLAG_DELETED_MAILBOX = 0x02,
14
DSYNC_MAILBOX_FLAG_DELETED_DIR = 0x04
17
struct dsync_mailbox {
20
/* 128bit SHA1 sum of mailbox name */
21
mailbox_guid_t name_sha1;
22
/* Mailbox's GUID. Full of zero with \Noselect mailboxes. */
23
mailbox_guid_t mailbox_guid;
25
uint32_t uid_validity, uid_next, message_count, first_recent_uid;
26
uint64_t highest_modseq;
27
/* if mailbox is deleted, this is the deletion timestamp.
28
otherwise it's the last rename timestamp. */
30
enum dsync_mailbox_flags flags;
31
ARRAY_TYPE(const_string) cache_fields;
33
ARRAY_DEFINE_TYPE(dsync_mailbox, struct dsync_mailbox *);
34
#define dsync_mailbox_is_noselect(dsync_box) \
35
(((dsync_box)->flags & DSYNC_MAILBOX_FLAG_NOSELECT) != 0)
37
/* dsync_worker_msg_iter_next() returns also all expunged messages from
38
the end of mailbox with this flag set. The GUIDs are 128 bit GUIDs saved
39
to transaction log (mail_generate_guid_128_hash()). */
40
#define DSYNC_MAIL_FLAG_EXPUNGED 0x10000000
42
struct dsync_message {
45
enum mail_flags flags;
46
/* keywords are sorted by name */
47
const char *const *keywords;
52
struct dsync_msg_static_data {
53
const char *pop3_uidl;
55
struct istream *input;
58
struct dsync_mailbox *
59
dsync_mailbox_dup(pool_t pool, const struct dsync_mailbox *box);
61
struct dsync_message *
62
dsync_message_dup(pool_t pool, const struct dsync_message *msg);
64
int dsync_mailbox_guid_cmp(const struct dsync_mailbox *box1,
65
const struct dsync_mailbox *box2);
66
int dsync_mailbox_p_guid_cmp(struct dsync_mailbox *const *box1,
67
struct dsync_mailbox *const *box2);
69
int dsync_mailbox_name_sha1_cmp(const struct dsync_mailbox *box1,
70
const struct dsync_mailbox *box2);
71
int dsync_mailbox_p_name_sha1_cmp(struct dsync_mailbox *const *box1,
72
struct dsync_mailbox *const *box2);
74
bool dsync_keyword_list_equals(const char *const *k1, const char *const *k2);
76
bool dsync_guid_equals(const mailbox_guid_t *guid1,
77
const mailbox_guid_t *guid2);
78
int dsync_guid_cmp(const mailbox_guid_t *guid1, const mailbox_guid_t *guid2);
79
const char *dsync_guid_to_str(const mailbox_guid_t *guid);
80
const char *dsync_get_guid_128_str(const char *guid, unsigned char *dest,
81
unsigned int dest_len);
82
void dsync_str_sha_to_guid(const char *str, mailbox_guid_t *guid);