~ubuntu-branches/ubuntu/wily/dovecot/wily

« back to all changes in this revision

Viewing changes to src/doveadm/dsync/dsync-mail.h

  • Committer: Package Import Robot
  • Author(s): Jaldhar H. Vyas
  • Date: 2013-09-09 00:57:32 UTC
  • mfrom: (1.13.11)
  • mto: (4.8.5 experimental) (1.16.1)
  • mto: This revision was merged to the branch mainline in revision 97.
  • Revision ID: package-import@ubuntu.com-20130909005732-dn1eell8srqbhh0e
Tags: upstream-2.2.5
ImportĀ upstreamĀ versionĀ 2.2.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef DSYNC_MAIL_H
 
2
#define DSYNC_MAIL_H
 
3
 
 
4
#include "mail-types.h"
 
5
 
 
6
struct mail;
 
7
 
 
8
struct dsync_mail {
 
9
        /* either GUID="" or uid=0 */
 
10
        const char *guid;
 
11
        uint32_t uid;
 
12
 
 
13
        const char *pop3_uidl;
 
14
        unsigned int pop3_order;
 
15
        time_t received_date;
 
16
 
 
17
        /* Input stream containing the message text, or NULL if all instances
 
18
           of the message were already expunged from this mailbox. */
 
19
        struct istream *input;
 
20
 
 
21
        /* If non-NULL, we're syncing within the dsync process using ibc-pipe.
 
22
           This mail can be used to mailbox_copy() the mail. */
 
23
        struct mail *input_mail;
 
24
        /* Verify that this equals to input_mail->uid */
 
25
        uint32_t input_mail_uid;
 
26
};
 
27
 
 
28
struct dsync_mail_request {
 
29
        /* either GUID=NULL or uid=0 */
 
30
        const char *guid;
 
31
        uint32_t uid;
 
32
};
 
33
 
 
34
enum dsync_mail_change_type {
 
35
        DSYNC_MAIL_CHANGE_TYPE_SAVE,
 
36
        DSYNC_MAIL_CHANGE_TYPE_EXPUNGE,
 
37
        DSYNC_MAIL_CHANGE_TYPE_FLAG_CHANGE
 
38
};
 
39
 
 
40
#define KEYWORD_CHANGE_ADD '+'
 
41
#define KEYWORD_CHANGE_REMOVE '-'
 
42
#define KEYWORD_CHANGE_FINAL '='
 
43
#define KEYWORD_CHANGE_ADD_AND_FINAL '&'
 
44
 
 
45
struct dsync_mail_change {
 
46
        enum dsync_mail_change_type type;
 
47
 
 
48
        uint32_t uid;
 
49
        /* Message's GUID:
 
50
            - for expunges either 128bit hex or NULL if unknown
 
51
            - "" if backend doesn't support GUIDs */
 
52
        const char *guid;
 
53
        /* If GUID is "", this contains hash of the message header,
 
54
           otherwise NULL */
 
55
        const char *hdr_hash;
 
56
 
 
57
        /* Message's current modseq (saves, flag changes) */
 
58
        uint64_t modseq;
 
59
        /* Message's current private modseq (for private flags in
 
60
           shared mailboxes, otherwise 0) */
 
61
        uint64_t pvt_modseq;
 
62
        /* Message's save timestamp (saves) */
 
63
        time_t save_timestamp;
 
64
 
 
65
        /* List of flag/keyword changes: (saves, flag changes) */
 
66
 
 
67
        /* Flags added/removed since last sync, and final flags containing
 
68
           flags that exist now but haven't changed */
 
69
        uint8_t add_flags, remove_flags, final_flags;
 
70
        uint8_t add_pvt_flags, remove_pvt_flags;
 
71
        /* Remove all keywords before applying changes. This is used only with
 
72
           old transaction logs, new ones never reset keywords (just explicitly
 
73
           remove unwanted keywords) */
 
74
        bool keywords_reset;
 
75
        /* +add, -remove, =final, &add_and_final. */
 
76
        ARRAY_TYPE(const_string) keyword_changes;
 
77
};
 
78
 
 
79
int dsync_mail_get_hdr_hash(struct mail *mail, const char **hdr_hash_r);
 
80
int dsync_mail_fill(struct mail *mail, struct dsync_mail *dmail_r,
 
81
                    const char **error_field_r);
 
82
 
 
83
void dsync_mail_change_dup(pool_t pool, const struct dsync_mail_change *src,
 
84
                           struct dsync_mail_change *dest_r);
 
85
 
 
86
#endif