annotate src/lib-storage/mail-storage.h @ 2327:7d02e2a7672d HEAD

Header caching redesigned. New design allows caching decisions per field, so they can be divided to temporary/permanent. Cached headers are now always returned in original order, old code didn't guarantee it. Some other caching changes. (still missing code to store changes in caching decisions)
author Timo Sirainen <tss@iki.fi>
date Sun, 18 Jul 2004 05:25:06 +0300
parents aae574ed7f4c
children 1371d41c375f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
1 #ifndef __MAIL_STORAGE_H
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
2 #define __MAIL_STORAGE_H
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
3
988
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 953
diff changeset
4 struct message_size;
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 953
diff changeset
5
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
6 #include "mail-types.h"
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
7
1622
d22e03714d36 index_mmap_invalidate = yes now invalidate memory maps before accessing
Timo Sirainen <tss@iki.fi>
parents: 1552
diff changeset
8 enum mailbox_open_flags {
d22e03714d36 index_mmap_invalidate = yes now invalidate memory maps before accessing
Timo Sirainen <tss@iki.fi>
parents: 1552
diff changeset
9 MAILBOX_OPEN_READONLY = 0x01,
2039
f0925b2271e1 Added pop3_mails_keep_recent option. Fixed recent assert crash.
Timo Sirainen <tss@iki.fi>
parents: 1958
diff changeset
10 MAILBOX_OPEN_FAST = 0x02,
f0925b2271e1 Added pop3_mails_keep_recent option. Fixed recent assert crash.
Timo Sirainen <tss@iki.fi>
parents: 1958
diff changeset
11 MAILBOX_OPEN_KEEP_RECENT = 0x04
1622
d22e03714d36 index_mmap_invalidate = yes now invalidate memory maps before accessing
Timo Sirainen <tss@iki.fi>
parents: 1552
diff changeset
12 };
d22e03714d36 index_mmap_invalidate = yes now invalidate memory maps before accessing
Timo Sirainen <tss@iki.fi>
parents: 1552
diff changeset
13
1198
d28571e8c810 Rewrote LIST, LSUB and subscription file handling. LIST replies aren't
Timo Sirainen <tss@iki.fi>
parents: 1179
diff changeset
14 enum mailbox_list_flags {
1244
40bae47bdba1 Added support for CHILDREN and LISTEXT extensions.
Timo Sirainen <tss@iki.fi>
parents: 1218
diff changeset
15 MAILBOX_LIST_SUBSCRIBED = 0x01,
40bae47bdba1 Added support for CHILDREN and LISTEXT extensions.
Timo Sirainen <tss@iki.fi>
parents: 1218
diff changeset
16 MAILBOX_LIST_FAST_FLAGS = 0x02,
40bae47bdba1 Added support for CHILDREN and LISTEXT extensions.
Timo Sirainen <tss@iki.fi>
parents: 1218
diff changeset
17 MAILBOX_LIST_CHILDREN = 0x04
1198
d28571e8c810 Rewrote LIST, LSUB and subscription file handling. LIST replies aren't
Timo Sirainen <tss@iki.fi>
parents: 1179
diff changeset
18 };
d28571e8c810 Rewrote LIST, LSUB and subscription file handling. LIST replies aren't
Timo Sirainen <tss@iki.fi>
parents: 1179
diff changeset
19
903
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 889
diff changeset
20 enum mailbox_flags {
1244
40bae47bdba1 Added support for CHILDREN and LISTEXT extensions.
Timo Sirainen <tss@iki.fi>
parents: 1218
diff changeset
21 MAILBOX_NOSELECT = 0x001,
40bae47bdba1 Added support for CHILDREN and LISTEXT extensions.
Timo Sirainen <tss@iki.fi>
parents: 1218
diff changeset
22 MAILBOX_NONEXISTENT = 0x002,
40bae47bdba1 Added support for CHILDREN and LISTEXT extensions.
Timo Sirainen <tss@iki.fi>
parents: 1218
diff changeset
23 MAILBOX_PLACEHOLDER = 0x004,
40bae47bdba1 Added support for CHILDREN and LISTEXT extensions.
Timo Sirainen <tss@iki.fi>
parents: 1218
diff changeset
24 MAILBOX_CHILDREN = 0x008,
40bae47bdba1 Added support for CHILDREN and LISTEXT extensions.
Timo Sirainen <tss@iki.fi>
parents: 1218
diff changeset
25 MAILBOX_NOCHILDREN = 0x010,
40bae47bdba1 Added support for CHILDREN and LISTEXT extensions.
Timo Sirainen <tss@iki.fi>
parents: 1218
diff changeset
26 MAILBOX_NOINFERIORS = 0x020,
40bae47bdba1 Added support for CHILDREN and LISTEXT extensions.
Timo Sirainen <tss@iki.fi>
parents: 1218
diff changeset
27 MAILBOX_MARKED = 0x040,
40bae47bdba1 Added support for CHILDREN and LISTEXT extensions.
Timo Sirainen <tss@iki.fi>
parents: 1218
diff changeset
28 MAILBOX_UNMARKED = 0x080,
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
29
1244
40bae47bdba1 Added support for CHILDREN and LISTEXT extensions.
Timo Sirainen <tss@iki.fi>
parents: 1218
diff changeset
30 MAILBOX_READONLY = 0x100
903
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 889
diff changeset
31 };
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
32
903
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 889
diff changeset
33 enum mailbox_status_items {
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
34 STATUS_MESSAGES = 0x01,
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
35 STATUS_RECENT = 0x02,
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
36 STATUS_UIDNEXT = 0x04,
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
37 STATUS_UIDVALIDITY = 0x08,
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
38 STATUS_UNSEEN = 0x10,
100
867ec80dbf42 Custom flags are now shown in FLAGS and PERMANENTFLAGS lists after SELECT.
Timo Sirainen <tss@iki.fi>
parents: 50
diff changeset
39 STATUS_FIRST_UNSEEN_SEQ = 0x20,
1958
4dec6a3d79fd s/custom flags/keywords/
Timo Sirainen <tss@iki.fi>
parents: 1917
diff changeset
40 STATUS_KEYWORDS = 0x40
903
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 889
diff changeset
41 };
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
42
903
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 889
diff changeset
43 enum mailbox_name_status {
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
44 MAILBOX_NAME_EXISTS,
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
45 MAILBOX_NAME_VALID,
889
f6e6812bd872 comment updates
Timo Sirainen <tss@iki.fi>
parents: 883
diff changeset
46 MAILBOX_NAME_INVALID,
f6e6812bd872 comment updates
Timo Sirainen <tss@iki.fi>
parents: 883
diff changeset
47 MAILBOX_NAME_NOINFERIORS
903
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 889
diff changeset
48 };
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
49
906
b176f913d092 "ISO C forbids forward references to enum types"
Timo Sirainen <tss@iki.fi>
parents: 903
diff changeset
50 enum mail_sort_type {
988
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 953
diff changeset
51 /* Maximum size for sort program, 2x for reverse + END */
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 953
diff changeset
52 #define MAX_SORT_PROGRAM_SIZE (2*7 + 1)
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 953
diff changeset
53
906
b176f913d092 "ISO C forbids forward references to enum types"
Timo Sirainen <tss@iki.fi>
parents: 903
diff changeset
54 MAIL_SORT_ARRIVAL = 0x0010,
b176f913d092 "ISO C forbids forward references to enum types"
Timo Sirainen <tss@iki.fi>
parents: 903
diff changeset
55 MAIL_SORT_CC = 0x0020,
b176f913d092 "ISO C forbids forward references to enum types"
Timo Sirainen <tss@iki.fi>
parents: 903
diff changeset
56 MAIL_SORT_DATE = 0x0040,
b176f913d092 "ISO C forbids forward references to enum types"
Timo Sirainen <tss@iki.fi>
parents: 903
diff changeset
57 MAIL_SORT_FROM = 0x0080,
b176f913d092 "ISO C forbids forward references to enum types"
Timo Sirainen <tss@iki.fi>
parents: 903
diff changeset
58 MAIL_SORT_SIZE = 0x0100,
b176f913d092 "ISO C forbids forward references to enum types"
Timo Sirainen <tss@iki.fi>
parents: 903
diff changeset
59 MAIL_SORT_SUBJECT = 0x0200,
b176f913d092 "ISO C forbids forward references to enum types"
Timo Sirainen <tss@iki.fi>
parents: 903
diff changeset
60 MAIL_SORT_TO = 0x0400,
b176f913d092 "ISO C forbids forward references to enum types"
Timo Sirainen <tss@iki.fi>
parents: 903
diff changeset
61
b176f913d092 "ISO C forbids forward references to enum types"
Timo Sirainen <tss@iki.fi>
parents: 903
diff changeset
62 MAIL_SORT_REVERSE = 0x0001, /* reverse the next type */
b176f913d092 "ISO C forbids forward references to enum types"
Timo Sirainen <tss@iki.fi>
parents: 903
diff changeset
63
b176f913d092 "ISO C forbids forward references to enum types"
Timo Sirainen <tss@iki.fi>
parents: 903
diff changeset
64 MAIL_SORT_END = 0x0000 /* ends sort program */
b176f913d092 "ISO C forbids forward references to enum types"
Timo Sirainen <tss@iki.fi>
parents: 903
diff changeset
65 };
b176f913d092 "ISO C forbids forward references to enum types"
Timo Sirainen <tss@iki.fi>
parents: 903
diff changeset
66
988
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 953
diff changeset
67 enum mail_fetch_field {
2238
9cc23c29aaec Added a framework for getting POP3 UIDL strings from mail-storage. The
Timo Sirainen <tss@iki.fi>
parents: 2219
diff changeset
68 MAIL_FETCH_FLAGS = 0x00000001,
9cc23c29aaec Added a framework for getting POP3 UIDL strings from mail-storage. The
Timo Sirainen <tss@iki.fi>
parents: 2219
diff changeset
69 MAIL_FETCH_MESSAGE_PARTS = 0x00000002,
988
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 953
diff changeset
70
2238
9cc23c29aaec Added a framework for getting POP3 UIDL strings from mail-storage. The
Timo Sirainen <tss@iki.fi>
parents: 2219
diff changeset
71 MAIL_FETCH_RECEIVED_DATE = 0x00000004,
9cc23c29aaec Added a framework for getting POP3 UIDL strings from mail-storage. The
Timo Sirainen <tss@iki.fi>
parents: 2219
diff changeset
72 MAIL_FETCH_DATE = 0x00000008,
9cc23c29aaec Added a framework for getting POP3 UIDL strings from mail-storage. The
Timo Sirainen <tss@iki.fi>
parents: 2219
diff changeset
73 MAIL_FETCH_SIZE = 0x00000010,
988
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 953
diff changeset
74
2238
9cc23c29aaec Added a framework for getting POP3 UIDL strings from mail-storage. The
Timo Sirainen <tss@iki.fi>
parents: 2219
diff changeset
75 MAIL_FETCH_STREAM_HEADER = 0x00000020,
9cc23c29aaec Added a framework for getting POP3 UIDL strings from mail-storage. The
Timo Sirainen <tss@iki.fi>
parents: 2219
diff changeset
76 MAIL_FETCH_STREAM_BODY = 0x00000040,
988
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 953
diff changeset
77
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 953
diff changeset
78 /* specials: */
2238
9cc23c29aaec Added a framework for getting POP3 UIDL strings from mail-storage. The
Timo Sirainen <tss@iki.fi>
parents: 2219
diff changeset
79 MAIL_FETCH_IMAP_BODY = 0x00001000,
9cc23c29aaec Added a framework for getting POP3 UIDL strings from mail-storage. The
Timo Sirainen <tss@iki.fi>
parents: 2219
diff changeset
80 MAIL_FETCH_IMAP_BODYSTRUCTURE = 0x00002000,
9cc23c29aaec Added a framework for getting POP3 UIDL strings from mail-storage. The
Timo Sirainen <tss@iki.fi>
parents: 2219
diff changeset
81 MAIL_FETCH_IMAP_ENVELOPE = 0x00004000,
9cc23c29aaec Added a framework for getting POP3 UIDL strings from mail-storage. The
Timo Sirainen <tss@iki.fi>
parents: 2219
diff changeset
82 MAIL_FETCH_FROM_ENVELOPE = 0x00008000,
9cc23c29aaec Added a framework for getting POP3 UIDL strings from mail-storage. The
Timo Sirainen <tss@iki.fi>
parents: 2219
diff changeset
83 MAIL_FETCH_UID_STRING = 0x00010000
988
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 953
diff changeset
84 };
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 953
diff changeset
85
1730
8480f945e270 IDLE uses now IO_*_NOTIFY to get instant notifying of mails.
Timo Sirainen <tss@iki.fi>
parents: 1728
diff changeset
86 enum mailbox_sync_flags {
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
87 MAILBOX_SYNC_FLAG_FAST = 0x01,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
88 MAILBOX_SYNC_FLAG_NO_EXPUNGES = 0x02,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
89 MAILBOX_SYNC_AUTO_STOP = 0x04
1552
bc3307f2f35d Only NOOP and CHECK will now always do a real mailbox sync. Other commands
Timo Sirainen <tss@iki.fi>
parents: 1534
diff changeset
90 };
bc3307f2f35d Only NOOP and CHECK will now always do a real mailbox sync. Other commands
Timo Sirainen <tss@iki.fi>
parents: 1534
diff changeset
91
2322
aae574ed7f4c Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents: 2316
diff changeset
92 enum mailbox_sync_type {
aae574ed7f4c Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents: 2316
diff changeset
93 MAILBOX_SYNC_TYPE_EXPUNGE = 0x01,
aae574ed7f4c Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents: 2316
diff changeset
94 MAILBOX_SYNC_TYPE_FLAGS = 0x02
aae574ed7f4c Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents: 2316
diff changeset
95 };
aae574ed7f4c Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents: 2316
diff changeset
96
903
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 889
diff changeset
97 struct mail_storage;
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 889
diff changeset
98 struct mail_storage_callbacks;
1198
d28571e8c810 Rewrote LIST, LSUB and subscription file handling. LIST replies aren't
Timo Sirainen <tss@iki.fi>
parents: 1179
diff changeset
99 struct mailbox_list;
903
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 889
diff changeset
100 struct mailbox_status;
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 889
diff changeset
101 struct mail_search_arg;
988
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 953
diff changeset
102 struct fetch_context;
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 953
diff changeset
103 struct search_context;
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
104 struct mail;
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
105 struct mailbox;
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
106 struct mailbox_list_context;
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
107 struct mailbox_transaction_context;
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
108
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
109 struct mailbox_list {
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
110 const char *name;
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
111 enum mailbox_flags flags;
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
112 };
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
113
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
114 struct mailbox_status {
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
115 uint32_t messages;
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
116 uint32_t recent;
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
117 uint32_t unseen;
674
b7aefd0d7611 Locking changes triggered a bit larger cleanup :) If we have to wait for a
Timo Sirainen <tss@iki.fi>
parents: 568
diff changeset
118
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
119 uint32_t uidvalidity;
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
120 uint32_t uidnext;
450
925d6eb5f8be MailStorage interface change. We now let storage call several sync-functions
Timo Sirainen <tss@iki.fi>
parents: 410
diff changeset
121
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
122 uint32_t first_unseen_seq;
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
123
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
124 unsigned int diskspace_full:1;
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
125
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
126 /* may be allocated from data stack */
1958
4dec6a3d79fd s/custom flags/keywords/
Timo Sirainen <tss@iki.fi>
parents: 1917
diff changeset
127 unsigned int keywords_count;
4dec6a3d79fd s/custom flags/keywords/
Timo Sirainen <tss@iki.fi>
parents: 1917
diff changeset
128 const char **keywords;
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
129 };
450
925d6eb5f8be MailStorage interface change. We now let storage call several sync-functions
Timo Sirainen <tss@iki.fi>
parents: 410
diff changeset
130
2322
aae574ed7f4c Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents: 2316
diff changeset
131 struct mailbox_sync_rec {
aae574ed7f4c Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents: 2316
diff changeset
132 uint32_t seq1, seq2;
aae574ed7f4c Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents: 2316
diff changeset
133 enum mailbox_sync_type type;
aae574ed7f4c Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents: 2316
diff changeset
134 };
aae574ed7f4c Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents: 2316
diff changeset
135
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
136 struct mail_storage_callbacks {
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
137 /* Alert: Not enough disk space */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
138 void (*alert_no_diskspace)(struct mailbox *mailbox, void *context);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
139 /* "* OK <text>" */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
140 void (*notify_ok)(struct mailbox *mailbox, const char *text,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
141 void *context);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
142 /* "* NO <text>" */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
143 void (*notify_no)(struct mailbox *mailbox, const char *text,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
144 void *context);
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
145
2322
aae574ed7f4c Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents: 2316
diff changeset
146 };
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
147
2322
aae574ed7f4c Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents: 2316
diff changeset
148 typedef void mailbox_notify_callback_t(struct mailbox *box, void *context);
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
149
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
150 extern int full_filesystem_access;
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
151
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
152 void mail_storage_init(void);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
153 void mail_storage_deinit(void);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
154
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
155 /* register all mail storages */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
156 void mail_storage_register_all(void);
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
157
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
158 /* Register mail storage class with given name - all methods that are NULL
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
159 are set to default methods */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
160 void mail_storage_class_register(struct mail_storage *storage_class);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
161 void mail_storage_class_unregister(struct mail_storage *storage_class);
1642
72c6e848f583 API changes: Don't keep variables in mailbox class.
Timo Sirainen <tss@iki.fi>
parents: 1640
diff changeset
162
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
163 /* Create a new instance of registered mail storage class with given
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
164 storage-specific data. If data is NULL, it tries to use defaults.
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
165 May return NULL if anything fails.
1642
72c6e848f583 API changes: Don't keep variables in mailbox class.
Timo Sirainen <tss@iki.fi>
parents: 1640
diff changeset
166
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
167 If namespace is non-NULL, all mailbox names are expected to begin with it.
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
168 hierarchy_sep overrides the default separator if it's not '\0'. */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
169 struct mail_storage *
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
170 mail_storage_create(const char *name, const char *data, const char *user,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
171 const char *namespace, char hierarchy_sep);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
172 void mail_storage_destroy(struct mail_storage *storage);
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
173
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
174 struct mail_storage *
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
175 mail_storage_create_default(const char *user,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
176 const char *namespace, char hierarchy_sep);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
177 struct mail_storage *
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
178 mail_storage_create_with_data(const char *data, const char *user,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
179 const char *namespace, char hierarchy_sep);
1639
3621292209f4 Explicit lock() method for mailbox.
Timo Sirainen <tss@iki.fi>
parents: 1638
diff changeset
180
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
181 char mail_storage_get_hierarchy_sep(struct mail_storage *storage);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
182
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
183 /* Set storage callback functions to use. */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
184 void mail_storage_set_callbacks(struct mail_storage *storage,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
185 struct mail_storage_callbacks *callbacks,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
186 void *context);
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
187
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
188 /* name is allowed to contain multiple new hierarchy levels.
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
189 If directory is TRUE, the mailbox should be created so that it
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
190 can contain children. The mailbox itself doesn't have to be
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
191 created as long as it shows in LIST. */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
192 int mail_storage_mailbox_create(struct mail_storage *storage, const char *name,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
193 int directory);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
194 /* Only the specified mailbox is deleted, ie. folders under the
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
195 specified mailbox must not be deleted. */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
196 int mail_storage_mailbox_delete(struct mail_storage *storage, const char *name);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
197 /* If the name has inferior hierarchical names, then the inferior
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
198 hierarchical names MUST also be renamed (ie. foo -> bar renames
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
199 also foo/bar -> bar/bar). newname may contain multiple new
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
200 hierarchies.
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
201
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
202 If oldname is case-insensitively "INBOX", the mails are moved
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
203 into new folder but the INBOX folder must not be deleted. */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
204 int mail_storage_mailbox_rename(struct mail_storage *storage,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
205 const char *oldname, const char *newname);
1172
f7c273202dc3 Support for IDLE extension.
Timo Sirainen <tss@iki.fi>
parents: 1151
diff changeset
206
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
207 /* Initialize new mailbox list request. mask may contain '%' and '*'
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
208 wildcards as defined in RFC2060. Matching against "INBOX" is
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
209 case-insensitive, but anything else is not. */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
210 struct mailbox_list_context *
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
211 mail_storage_mailbox_list_init(struct mail_storage *storage,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
212 const char *mask,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
213 enum mailbox_list_flags flags);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
214 /* Get next mailbox. Returns the mailbox name */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
215 struct mailbox_list *
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
216 mail_storage_mailbox_list_next(struct mailbox_list_context *ctx);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
217 /* Deinitialize mailbox list request. Returns FALSE if some error
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
218 occured while listing. */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
219 int mail_storage_mailbox_list_deinit(struct mailbox_list_context *ctx);
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
220
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
221 /* Subscribe/unsubscribe mailbox. There should be no error when
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
222 subscribing to already subscribed mailbox. Subscribing to
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
223 unexisting mailboxes is optional. */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
224 int mail_storage_set_subscribed(struct mail_storage *storage,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
225 const char *name, int set);
988
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 953
diff changeset
226
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
227 /* Returns mailbox name status */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
228 int mail_storage_get_mailbox_name_status(struct mail_storage *storage,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
229 const char *name,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
230 enum mailbox_name_status *status);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
231
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
232 /* Returns the error message of last occured error. */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
233 const char *mail_storage_get_last_error(struct mail_storage *storage,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
234 int *syntax_error_r);
988
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 953
diff changeset
235
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
236 /* Open a mailbox. If readonly is TRUE, mailbox must not be
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
237 modified in any way even when it's asked. If fast is TRUE,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
238 any extra time consuming operations shouldn't be performed
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
239 (eg. when opening mailbox just for STATUS).
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
240
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
241 Note that append and copy may open the selected mailbox again
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
242 with possibly different readonly-state. */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
243 struct mailbox *mailbox_open(struct mail_storage *storage,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
244 const char *name, enum mailbox_open_flags flags);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
245 /* Close the box. Returns FALSE if some cleanup errors occured, but
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
246 the mailbox was closed anyway. */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
247 int mailbox_close(struct mailbox *box);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
248
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
249 /* Returns storage of given mailbox */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
250 struct mail_storage *mailbox_get_storage(struct mailbox *box);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
251
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
252 /* Returns name of given mailbox */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
253 const char *mailbox_get_name(struct mailbox *box);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
254
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
255 /* Returns TRUE if mailbox is read-only. */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
256 int mailbox_is_readonly(struct mailbox *box);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
257
1958
4dec6a3d79fd s/custom flags/keywords/
Timo Sirainen <tss@iki.fi>
parents: 1917
diff changeset
258 /* Returns TRUE if mailbox currently supports adding keywords. */
4dec6a3d79fd s/custom flags/keywords/
Timo Sirainen <tss@iki.fi>
parents: 1917
diff changeset
259 int mailbox_allow_new_keywords(struct mailbox *box);
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
260
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
261 /* Gets the mailbox status information. */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
262 int mailbox_get_status(struct mailbox *box,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
263 enum mailbox_status_items items,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
264 struct mailbox_status *status);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
265
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
266 /* Synchronize the mailbox. */
2322
aae574ed7f4c Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents: 2316
diff changeset
267 struct mailbox_sync_context *
aae574ed7f4c Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents: 2316
diff changeset
268 mailbox_sync_init(struct mailbox *box, enum mailbox_sync_flags flags);
aae574ed7f4c Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents: 2316
diff changeset
269 int mailbox_sync_next(struct mailbox_sync_context *ctx,
aae574ed7f4c Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents: 2316
diff changeset
270 struct mailbox_sync_rec *sync_rec_r);
aae574ed7f4c Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents: 2316
diff changeset
271 int mailbox_sync_deinit(struct mailbox_sync_context *ctx,
aae574ed7f4c Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents: 2316
diff changeset
272 struct mailbox_status *status_r);
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
273
2322
aae574ed7f4c Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents: 2316
diff changeset
274 /* Call given callback function when something changes in the mailbox.
aae574ed7f4c Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents: 2316
diff changeset
275 It's done until this function is called with callback = NULL. */
aae574ed7f4c Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents: 2316
diff changeset
276 void mailbox_notify_changes(struct mailbox *box, unsigned int min_interval,
aae574ed7f4c Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents: 2316
diff changeset
277 mailbox_notify_callback_t *callback, void *context);
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
278
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
279 struct mailbox_transaction_context *
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
280 mailbox_transaction_begin(struct mailbox *box, int hide);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
281 int mailbox_transaction_commit(struct mailbox_transaction_context *t);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
282 void mailbox_transaction_rollback(struct mailbox_transaction_context *t);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
283
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
284 /* Simplified fetching for a single sequence. */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
285 struct mail *mailbox_fetch(struct mailbox_transaction_context *t, uint32_t seq,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
286 enum mail_fetch_field wanted_fields);
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
287
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
288 /* Convert uid range to sequence range. */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
289 int mailbox_get_uids(struct mailbox *box, uint32_t uid1, uint32_t uid2,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
290 uint32_t *seq1_r, uint32_t *seq2_r);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
291
2327
7d02e2a7672d Header caching redesigned. New design allows caching decisions per field, so
Timo Sirainen <tss@iki.fi>
parents: 2322
diff changeset
292 /* Initialize header lookup for given headers. */
7d02e2a7672d Header caching redesigned. New design allows caching decisions per field, so
Timo Sirainen <tss@iki.fi>
parents: 2322
diff changeset
293 struct mailbox_header_lookup_ctx *
7d02e2a7672d Header caching redesigned. New design allows caching decisions per field, so
Timo Sirainen <tss@iki.fi>
parents: 2322
diff changeset
294 mailbox_header_lookup_init(struct mailbox *box, const char *const headers[]);
7d02e2a7672d Header caching redesigned. New design allows caching decisions per field, so
Timo Sirainen <tss@iki.fi>
parents: 2322
diff changeset
295 void mailbox_header_lookup_deinit(struct mailbox_header_lookup_ctx *ctx);
7d02e2a7672d Header caching redesigned. New design allows caching decisions per field, so
Timo Sirainen <tss@iki.fi>
parents: 2322
diff changeset
296
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
297 /* Modify sort_program to specify a sort program acceptable for
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
298 search_init(). If mailbox supports no sorting, it's simply set to
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
299 {MAIL_SORT_END}. */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
300 int mailbox_search_get_sorting(struct mailbox *box,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
301 enum mail_sort_type *sort_program);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
302 /* Initialize new search request. Search arguments are given so that
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
303 the storage can optimize the searching as it wants.
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
304
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
305 If sort_program is non-NULL, it requests that the returned messages
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
306 are sorted by the given criteria. sort_program must have gone
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
307 through search_get_sorting().
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
308
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
309 wanted_fields and wanted_headers aren't required, but they can be
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
310 used for optimizations. */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
311 struct mail_search_context *
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
312 mailbox_search_init(struct mailbox_transaction_context *t,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
313 const char *charset, struct mail_search_arg *args,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
314 const enum mail_sort_type *sort_program,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
315 enum mail_fetch_field wanted_fields,
2327
7d02e2a7672d Header caching redesigned. New design allows caching decisions per field, so
Timo Sirainen <tss@iki.fi>
parents: 2322
diff changeset
316 struct mailbox_header_lookup_ctx *wanted_headers);
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
317 /* Deinitialize search request. */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
318 int mailbox_search_deinit(struct mail_search_context *ctx);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
319 /* Search the next message. Returned mail object can be used until
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
320 the next call to search_next() or search_deinit(). */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
321 struct mail *mailbox_search_next(struct mail_search_context *ctx);
1637
a64391b49589 API change for copying messages.
Timo Sirainen <tss@iki.fi>
parents: 1622
diff changeset
322
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
323 /* Save a mail into mailbox. timezone_offset specifies the timezone in
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
324 minutes in which received_date was originally given with. To use
2190
755ec9442a58 mailbox_save() and mailbox_copy() functions can now return the saved mail so
Timo Sirainen <tss@iki.fi>
parents: 2062
diff changeset
325 current time, set received_date to (time_t)-1.
755ec9442a58 mailbox_save() and mailbox_copy() functions can now return the saved mail so
Timo Sirainen <tss@iki.fi>
parents: 2062
diff changeset
326
755ec9442a58 mailbox_save() and mailbox_copy() functions can now return the saved mail so
Timo Sirainen <tss@iki.fi>
parents: 2062
diff changeset
327 If mail_r is non-NULL, the saved message can be accessed using it.
755ec9442a58 mailbox_save() and mailbox_copy() functions can now return the saved mail so
Timo Sirainen <tss@iki.fi>
parents: 2062
diff changeset
328 Note that setting it non-NULL may require mailbox syncing, so don't give
755ec9442a58 mailbox_save() and mailbox_copy() functions can now return the saved mail so
Timo Sirainen <tss@iki.fi>
parents: 2062
diff changeset
329 give it unless you need it. */
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
330 int mailbox_save(struct mailbox_transaction_context *t,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
331 const struct mail_full_flags *flags,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
332 time_t received_date, int timezone_offset,
2190
755ec9442a58 mailbox_save() and mailbox_copy() functions can now return the saved mail so
Timo Sirainen <tss@iki.fi>
parents: 2062
diff changeset
333 const char *from_envelope, struct istream *data,
755ec9442a58 mailbox_save() and mailbox_copy() functions can now return the saved mail so
Timo Sirainen <tss@iki.fi>
parents: 2062
diff changeset
334 struct mail **mail_r);
755ec9442a58 mailbox_save() and mailbox_copy() functions can now return the saved mail so
Timo Sirainen <tss@iki.fi>
parents: 2062
diff changeset
335 /* Copy given message. If dest_mail_r is non-NULL, the copied message can be
755ec9442a58 mailbox_save() and mailbox_copy() functions can now return the saved mail so
Timo Sirainen <tss@iki.fi>
parents: 2062
diff changeset
336 accessed using it. Note that setting it non-NULL may require mailbox
755ec9442a58 mailbox_save() and mailbox_copy() functions can now return the saved mail so
Timo Sirainen <tss@iki.fi>
parents: 2062
diff changeset
337 syncing, so don't give give it unless you need it. */
755ec9442a58 mailbox_save() and mailbox_copy() functions can now return the saved mail so
Timo Sirainen <tss@iki.fi>
parents: 2062
diff changeset
338 int mailbox_copy(struct mailbox_transaction_context *t, struct mail *mail,
755ec9442a58 mailbox_save() and mailbox_copy() functions can now return the saved mail so
Timo Sirainen <tss@iki.fi>
parents: 2062
diff changeset
339 struct mail **dest_mail_r);
1640
db14aa8e2b5c API change for expunging messages. Not exactly what I wanted, but good
Timo Sirainen <tss@iki.fi>
parents: 1639
diff changeset
340
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
341 /* Returns TRUE if mailbox is now in inconsistent state, meaning that
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
342 the message IDs etc. may have changed - only way to recover this
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
343 would be to fully close the mailbox and reopen it. With IMAP
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
344 connection this would mean a forced disconnection since we can't
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
345 do forced CLOSE. */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
346 int mailbox_is_inconsistent(struct mailbox *box);
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
347
988
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 953
diff changeset
348 struct mail {
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 953
diff changeset
349 /* always set */
1637
a64391b49589 API change for copying messages.
Timo Sirainen <tss@iki.fi>
parents: 1622
diff changeset
350 struct mailbox *box;
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
351 uint32_t seq, uid;
988
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 953
diff changeset
352
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
353 unsigned int expunged:1;
1534
676995d7c0ca IMAP protocol doesn't allow server to send NULs to client. Send ascii #128
Timo Sirainen <tss@iki.fi>
parents: 1479
diff changeset
354 unsigned int has_nuls:1; /* message data is known to contain NULs */
676995d7c0ca IMAP protocol doesn't allow server to send NULs to client. Send ascii #128
Timo Sirainen <tss@iki.fi>
parents: 1479
diff changeset
355 unsigned int has_no_nuls:1; /* -''- known to not contain NULs */
988
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 953
diff changeset
356
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 953
diff changeset
357 const struct mail_full_flags *(*get_flags)(struct mail *mail);
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 953
diff changeset
358 const struct message_part *(*get_parts)(struct mail *mail);
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 953
diff changeset
359
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 953
diff changeset
360 /* Get the time message was received (IMAP INTERNALDATE).
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 953
diff changeset
361 Returns (time_t)-1 if error occured. */
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 953
diff changeset
362 time_t (*get_received_date)(struct mail *mail);
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 953
diff changeset
363 /* Get the Date-header in mail. Timezone is in minutes.
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 953
diff changeset
364 Returns (time_t)-1 if error occured, 0 if field wasn't found or
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 953
diff changeset
365 couldn't be parsed. */
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 953
diff changeset
366 time_t (*get_date)(struct mail *mail, int *timezone);
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 953
diff changeset
367 /* Get the full virtual size of mail (IMAP RFC822.SIZE).
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 953
diff changeset
368 Returns (uoff_t)-1 if error occured */
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 953
diff changeset
369 uoff_t (*get_size)(struct mail *mail);
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 953
diff changeset
370
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 953
diff changeset
371 /* Get value for single header field */
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 953
diff changeset
372 const char *(*get_header)(struct mail *mail, const char *field);
2327
7d02e2a7672d Header caching redesigned. New design allows caching decisions per field, so
Timo Sirainen <tss@iki.fi>
parents: 2322
diff changeset
373 /* Returns stream containing specified headers. */
7d02e2a7672d Header caching redesigned. New design allows caching decisions per field, so
Timo Sirainen <tss@iki.fi>
parents: 2322
diff changeset
374 struct istream *
7d02e2a7672d Header caching redesigned. New design allows caching decisions per field, so
Timo Sirainen <tss@iki.fi>
parents: 2322
diff changeset
375 (*get_headers)(struct mail *mail,
7d02e2a7672d Header caching redesigned. New design allows caching decisions per field, so
Timo Sirainen <tss@iki.fi>
parents: 2322
diff changeset
376 struct mailbox_header_lookup_ctx *headers);
988
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 953
diff changeset
377
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 953
diff changeset
378 /* Returns input stream pointing to beginning of message header.
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 953
diff changeset
379 hdr_size and body_size are updated unless they're NULL. */
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 953
diff changeset
380 struct istream *(*get_stream)(struct mail *mail,
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 953
diff changeset
381 struct message_size *hdr_size,
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 953
diff changeset
382 struct message_size *body_size);
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 953
diff changeset
383
2327
7d02e2a7672d Header caching redesigned. New design allows caching decisions per field, so
Timo Sirainen <tss@iki.fi>
parents: 2322
diff changeset
384 /* Get any of the "special" fields. */
988
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 953
diff changeset
385 const char *(*get_special)(struct mail *mail,
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 953
diff changeset
386 enum mail_fetch_field field);
1637
a64391b49589 API change for copying messages.
Timo Sirainen <tss@iki.fi>
parents: 1622
diff changeset
387
1638
e95c0e462591 API change for updating message flags.
Timo Sirainen <tss@iki.fi>
parents: 1637
diff changeset
388 /* Update message flags. */
e95c0e462591 API change for updating message flags.
Timo Sirainen <tss@iki.fi>
parents: 1637
diff changeset
389 int (*update_flags)(struct mail *mail,
e95c0e462591 API change for updating message flags.
Timo Sirainen <tss@iki.fi>
parents: 1637
diff changeset
390 const struct mail_full_flags *flags,
e95c0e462591 API change for updating message flags.
Timo Sirainen <tss@iki.fi>
parents: 1637
diff changeset
391 enum modify_type modify_type);
e95c0e462591 API change for updating message flags.
Timo Sirainen <tss@iki.fi>
parents: 1637
diff changeset
392
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
393 /* Expunge this message. Sequence numbers don't change until commit. */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
394 int (*expunge)(struct mail *mail);
450
925d6eb5f8be MailStorage interface change. We now let storage call several sync-functions
Timo Sirainen <tss@iki.fi>
parents: 410
diff changeset
395 };
925d6eb5f8be MailStorage interface change. We now let storage call several sync-functions
Timo Sirainen <tss@iki.fi>
parents: 410
diff changeset
396
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
397 #endif