annotate src/lib-storage/mail-storage.h @ 4076:7f48190f868f HEAD

Moved mailbox_list_flags to struct mailbox_list_context so plugins can see the flags more easily.
author Timo Sirainen <timo.sirainen@movial.fi>
date Mon, 27 Feb 2006 18:21:57 +0200
parents da1d65e064f8
children e2edd333c473
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
3033
146897976cfa Added mail_debug setting. Moved full_filesystem_access from global variable
Timo Sirainen <tss@iki.fi>
parents: 3016
diff changeset
8 enum mail_storage_flags {
146897976cfa Added mail_debug setting. Moved full_filesystem_access from global variable
Timo Sirainen <tss@iki.fi>
parents: 3016
diff changeset
9 /* Print debugging information while initializing the storage */
146897976cfa Added mail_debug setting. Moved full_filesystem_access from global variable
Timo Sirainen <tss@iki.fi>
parents: 3016
diff changeset
10 MAIL_STORAGE_FLAG_DEBUG = 0x01,
146897976cfa Added mail_debug setting. Moved full_filesystem_access from global variable
Timo Sirainen <tss@iki.fi>
parents: 3016
diff changeset
11 /* Allow full filesystem access with absolute or relative paths. */
3260
6a179bf1272e Moved several getenv()s from lib-storage to main code. deliver binary was
Timo Sirainen <tss@iki.fi>
parents: 3254
diff changeset
12 MAIL_STORAGE_FLAG_FULL_FS_ACCESS = 0x02,
6a179bf1272e Moved several getenv()s from lib-storage to main code. deliver binary was
Timo Sirainen <tss@iki.fi>
parents: 3254
diff changeset
13 /* Don't try to mmap() files */
6a179bf1272e Moved several getenv()s from lib-storage to main code. deliver binary was
Timo Sirainen <tss@iki.fi>
parents: 3254
diff changeset
14 MAIL_STORAGE_FLAG_MMAP_DISABLE = 0x04,
6a179bf1272e Moved several getenv()s from lib-storage to main code. deliver binary was
Timo Sirainen <tss@iki.fi>
parents: 3254
diff changeset
15 /* Don't try to write() to mmap()ed files. Required for the few
6a179bf1272e Moved several getenv()s from lib-storage to main code. deliver binary was
Timo Sirainen <tss@iki.fi>
parents: 3254
diff changeset
16 OSes that don't have unified buffer cache
6a179bf1272e Moved several getenv()s from lib-storage to main code. deliver binary was
Timo Sirainen <tss@iki.fi>
parents: 3254
diff changeset
17 (currently OpenBSD <= 3.5) */
6a179bf1272e Moved several getenv()s from lib-storage to main code. deliver binary was
Timo Sirainen <tss@iki.fi>
parents: 3254
diff changeset
18 MAIL_STORAGE_FLAG_MMAP_NO_WRITE = 0x08,
6a179bf1272e Moved several getenv()s from lib-storage to main code. deliver binary was
Timo Sirainen <tss@iki.fi>
parents: 3254
diff changeset
19 /* Remember message headers' MD5 sum */
6a179bf1272e Moved several getenv()s from lib-storage to main code. deliver binary was
Timo Sirainen <tss@iki.fi>
parents: 3254
diff changeset
20 MAIL_STORAGE_FLAG_KEEP_HEADER_MD5 = 0x10,
6a179bf1272e Moved several getenv()s from lib-storage to main code. deliver binary was
Timo Sirainen <tss@iki.fi>
parents: 3254
diff changeset
21 /* Use mmap() for reading mail files. */
6a179bf1272e Moved several getenv()s from lib-storage to main code. deliver binary was
Timo Sirainen <tss@iki.fi>
parents: 3254
diff changeset
22 MAIL_STORAGE_FLAG_MMAP_MAILS = 0x20,
6a179bf1272e Moved several getenv()s from lib-storage to main code. deliver binary was
Timo Sirainen <tss@iki.fi>
parents: 3254
diff changeset
23 /* Use CRLF linefeeds when saving mails. */
4076
7f48190f868f Moved mailbox_list_flags to struct mailbox_list_context so plugins can see the flags more easily.
Timo Sirainen <timo.sirainen@movial.fi>
parents: 4044
diff changeset
24 MAIL_STORAGE_FLAG_SAVE_CRLF = 0x40,
7f48190f868f Moved mailbox_list_flags to struct mailbox_list_context so plugins can see the flags more easily.
Timo Sirainen <timo.sirainen@movial.fi>
parents: 4044
diff changeset
25 /* The storage points to shared namespaces */
7f48190f868f Moved mailbox_list_flags to struct mailbox_list_context so plugins can see the flags more easily.
Timo Sirainen <timo.sirainen@movial.fi>
parents: 4044
diff changeset
26 MAIL_STORAGE_FLAG_SHARED_NAMESPACE = 0x80
3260
6a179bf1272e Moved several getenv()s from lib-storage to main code. deliver binary was
Timo Sirainen <tss@iki.fi>
parents: 3254
diff changeset
27 };
6a179bf1272e Moved several getenv()s from lib-storage to main code. deliver binary was
Timo Sirainen <tss@iki.fi>
parents: 3254
diff changeset
28
6a179bf1272e Moved several getenv()s from lib-storage to main code. deliver binary was
Timo Sirainen <tss@iki.fi>
parents: 3254
diff changeset
29 enum mail_storage_lock_method {
6a179bf1272e Moved several getenv()s from lib-storage to main code. deliver binary was
Timo Sirainen <tss@iki.fi>
parents: 3254
diff changeset
30 MAIL_STORAGE_LOCK_FCNTL,
6a179bf1272e Moved several getenv()s from lib-storage to main code. deliver binary was
Timo Sirainen <tss@iki.fi>
parents: 3254
diff changeset
31 MAIL_STORAGE_LOCK_FLOCK,
6a179bf1272e Moved several getenv()s from lib-storage to main code. deliver binary was
Timo Sirainen <tss@iki.fi>
parents: 3254
diff changeset
32 MAIL_STORAGE_LOCK_DOTLOCK
3033
146897976cfa Added mail_debug setting. Moved full_filesystem_access from global variable
Timo Sirainen <tss@iki.fi>
parents: 3016
diff changeset
33 };
146897976cfa Added mail_debug setting. Moved full_filesystem_access from global variable
Timo Sirainen <tss@iki.fi>
parents: 3016
diff changeset
34
1622
d22e03714d36 index_mmap_invalidate = yes now invalidate memory maps before accessing
Timo Sirainen <tss@iki.fi>
parents: 1552
diff changeset
35 enum mailbox_open_flags {
3245
6491dab63e54 Added input stream parameter to mailbox_open(). With mbox it now allows
Timo Sirainen <tss@iki.fi>
parents: 3209
diff changeset
36 /* Mailbox must not be modified even if asked */
1622
d22e03714d36 index_mmap_invalidate = yes now invalidate memory maps before accessing
Timo Sirainen <tss@iki.fi>
parents: 1552
diff changeset
37 MAILBOX_OPEN_READONLY = 0x01,
4041
9d7420b0e1ef Make life easier for plugins:
Timo Sirainen <timo.sirainen@movial.fi>
parents: 3971
diff changeset
38 /* Only saving/copying mails to mailbox works. */
9d7420b0e1ef Make life easier for plugins:
Timo Sirainen <timo.sirainen@movial.fi>
parents: 3971
diff changeset
39 MAILBOX_OPEN_SAVEONLY = 0x02,
3245
6491dab63e54 Added input stream parameter to mailbox_open(). With mbox it now allows
Timo Sirainen <tss@iki.fi>
parents: 3209
diff changeset
40 /* Any extra time consuming operations shouldn't be performed
6491dab63e54 Added input stream parameter to mailbox_open(). With mbox it now allows
Timo Sirainen <tss@iki.fi>
parents: 3209
diff changeset
41 (eg. when opening mailbox just for STATUS). */
4041
9d7420b0e1ef Make life easier for plugins:
Timo Sirainen <timo.sirainen@movial.fi>
parents: 3971
diff changeset
42 MAILBOX_OPEN_FAST = 0x04,
3245
6491dab63e54 Added input stream parameter to mailbox_open(). With mbox it now allows
Timo Sirainen <tss@iki.fi>
parents: 3209
diff changeset
43 /* Don't reset MAIL_RECENT flags when syncing */
4041
9d7420b0e1ef Make life easier for plugins:
Timo Sirainen <timo.sirainen@movial.fi>
parents: 3971
diff changeset
44 MAILBOX_OPEN_KEEP_RECENT = 0x08,
3628
571336db01f4 Added MAILBOX_OPEN_NO_INDEX_FILES flag and made streamed mboxes by default
Timo Sirainen <tss@iki.fi>
parents: 3520
diff changeset
45 /* Don't create index files for the mailbox */
4041
9d7420b0e1ef Make life easier for plugins:
Timo Sirainen <timo.sirainen@movial.fi>
parents: 3971
diff changeset
46 MAILBOX_OPEN_NO_INDEX_FILES = 0x10
1622
d22e03714d36 index_mmap_invalidate = yes now invalidate memory maps before accessing
Timo Sirainen <tss@iki.fi>
parents: 1552
diff changeset
47 };
d22e03714d36 index_mmap_invalidate = yes now invalidate memory maps before accessing
Timo Sirainen <tss@iki.fi>
parents: 1552
diff changeset
48
1198
d28571e8c810 Rewrote LIST, LSUB and subscription file handling. LIST replies aren't
Timo Sirainen <tss@iki.fi>
parents: 1179
diff changeset
49 enum mailbox_list_flags {
1244
40bae47bdba1 Added support for CHILDREN and LISTEXT extensions.
Timo Sirainen <tss@iki.fi>
parents: 1218
diff changeset
50 MAILBOX_LIST_SUBSCRIBED = 0x01,
40bae47bdba1 Added support for CHILDREN and LISTEXT extensions.
Timo Sirainen <tss@iki.fi>
parents: 1218
diff changeset
51 MAILBOX_LIST_FAST_FLAGS = 0x02,
2589
3a9a34bc0d05 Added MAILBOX_LIST_INBOX flag. Do the special cased INBOX handling only if
Timo Sirainen <tss@iki.fi>
parents: 2518
diff changeset
52 MAILBOX_LIST_CHILDREN = 0x04,
3a9a34bc0d05 Added MAILBOX_LIST_INBOX flag. Do the special cased INBOX handling only if
Timo Sirainen <tss@iki.fi>
parents: 2518
diff changeset
53 MAILBOX_LIST_INBOX = 0x04
1198
d28571e8c810 Rewrote LIST, LSUB and subscription file handling. LIST replies aren't
Timo Sirainen <tss@iki.fi>
parents: 1179
diff changeset
54 };
d28571e8c810 Rewrote LIST, LSUB and subscription file handling. LIST replies aren't
Timo Sirainen <tss@iki.fi>
parents: 1179
diff changeset
55
903
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 889
diff changeset
56 enum mailbox_flags {
1244
40bae47bdba1 Added support for CHILDREN and LISTEXT extensions.
Timo Sirainen <tss@iki.fi>
parents: 1218
diff changeset
57 MAILBOX_NOSELECT = 0x001,
40bae47bdba1 Added support for CHILDREN and LISTEXT extensions.
Timo Sirainen <tss@iki.fi>
parents: 1218
diff changeset
58 MAILBOX_NONEXISTENT = 0x002,
40bae47bdba1 Added support for CHILDREN and LISTEXT extensions.
Timo Sirainen <tss@iki.fi>
parents: 1218
diff changeset
59 MAILBOX_PLACEHOLDER = 0x004,
40bae47bdba1 Added support for CHILDREN and LISTEXT extensions.
Timo Sirainen <tss@iki.fi>
parents: 1218
diff changeset
60 MAILBOX_CHILDREN = 0x008,
40bae47bdba1 Added support for CHILDREN and LISTEXT extensions.
Timo Sirainen <tss@iki.fi>
parents: 1218
diff changeset
61 MAILBOX_NOCHILDREN = 0x010,
40bae47bdba1 Added support for CHILDREN and LISTEXT extensions.
Timo Sirainen <tss@iki.fi>
parents: 1218
diff changeset
62 MAILBOX_NOINFERIORS = 0x020,
40bae47bdba1 Added support for CHILDREN and LISTEXT extensions.
Timo Sirainen <tss@iki.fi>
parents: 1218
diff changeset
63 MAILBOX_MARKED = 0x040,
40bae47bdba1 Added support for CHILDREN and LISTEXT extensions.
Timo Sirainen <tss@iki.fi>
parents: 1218
diff changeset
64 MAILBOX_UNMARKED = 0x080,
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
65
1244
40bae47bdba1 Added support for CHILDREN and LISTEXT extensions.
Timo Sirainen <tss@iki.fi>
parents: 1218
diff changeset
66 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
67 };
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
68
903
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 889
diff changeset
69 enum mailbox_status_items {
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
70 STATUS_MESSAGES = 0x01,
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
71 STATUS_RECENT = 0x02,
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
72 STATUS_UIDNEXT = 0x04,
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
73 STATUS_UIDVALIDITY = 0x08,
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
74 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
75 STATUS_FIRST_UNSEEN_SEQ = 0x20,
1958
4dec6a3d79fd s/custom flags/keywords/
Timo Sirainen <tss@iki.fi>
parents: 1917
diff changeset
76 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
77 };
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
78
903
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 889
diff changeset
79 enum mailbox_name_status {
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
80 MAILBOX_NAME_EXISTS,
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
81 MAILBOX_NAME_VALID,
889
f6e6812bd872 comment updates
Timo Sirainen <tss@iki.fi>
parents: 883
diff changeset
82 MAILBOX_NAME_INVALID,
f6e6812bd872 comment updates
Timo Sirainen <tss@iki.fi>
parents: 883
diff changeset
83 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
84 };
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
85
906
b176f913d092 "ISO C forbids forward references to enum types"
Timo Sirainen <tss@iki.fi>
parents: 903
diff changeset
86 enum mail_sort_type {
988
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 953
diff changeset
87 /* 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
88 #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
89
906
b176f913d092 "ISO C forbids forward references to enum types"
Timo Sirainen <tss@iki.fi>
parents: 903
diff changeset
90 MAIL_SORT_ARRIVAL = 0x0010,
b176f913d092 "ISO C forbids forward references to enum types"
Timo Sirainen <tss@iki.fi>
parents: 903
diff changeset
91 MAIL_SORT_CC = 0x0020,
b176f913d092 "ISO C forbids forward references to enum types"
Timo Sirainen <tss@iki.fi>
parents: 903
diff changeset
92 MAIL_SORT_DATE = 0x0040,
b176f913d092 "ISO C forbids forward references to enum types"
Timo Sirainen <tss@iki.fi>
parents: 903
diff changeset
93 MAIL_SORT_FROM = 0x0080,
b176f913d092 "ISO C forbids forward references to enum types"
Timo Sirainen <tss@iki.fi>
parents: 903
diff changeset
94 MAIL_SORT_SIZE = 0x0100,
b176f913d092 "ISO C forbids forward references to enum types"
Timo Sirainen <tss@iki.fi>
parents: 903
diff changeset
95 MAIL_SORT_SUBJECT = 0x0200,
b176f913d092 "ISO C forbids forward references to enum types"
Timo Sirainen <tss@iki.fi>
parents: 903
diff changeset
96 MAIL_SORT_TO = 0x0400,
b176f913d092 "ISO C forbids forward references to enum types"
Timo Sirainen <tss@iki.fi>
parents: 903
diff changeset
97
b176f913d092 "ISO C forbids forward references to enum types"
Timo Sirainen <tss@iki.fi>
parents: 903
diff changeset
98 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
99
b176f913d092 "ISO C forbids forward references to enum types"
Timo Sirainen <tss@iki.fi>
parents: 903
diff changeset
100 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
101 };
b176f913d092 "ISO C forbids forward references to enum types"
Timo Sirainen <tss@iki.fi>
parents: 903
diff changeset
102
988
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 953
diff changeset
103 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
104 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
105 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
106
2238
9cc23c29aaec Added a framework for getting POP3 UIDL strings from mail-storage. The
Timo Sirainen <tss@iki.fi>
parents: 2219
diff changeset
107 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
108 MAIL_FETCH_DATE = 0x00000008,
2504
98f6057f27a1 Added mail.get_physical_size().
Timo Sirainen <tss@iki.fi>
parents: 2446
diff changeset
109 MAIL_FETCH_VIRTUAL_SIZE = 0x00000010,
98f6057f27a1 Added mail.get_physical_size().
Timo Sirainen <tss@iki.fi>
parents: 2446
diff changeset
110 MAIL_FETCH_PHYSICAL_SIZE = 0x00000020,
988
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 953
diff changeset
111
2504
98f6057f27a1 Added mail.get_physical_size().
Timo Sirainen <tss@iki.fi>
parents: 2446
diff changeset
112 MAIL_FETCH_STREAM_HEADER = 0x00000040,
98f6057f27a1 Added mail.get_physical_size().
Timo Sirainen <tss@iki.fi>
parents: 2446
diff changeset
113 MAIL_FETCH_STREAM_BODY = 0x00000080,
988
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 953
diff changeset
114
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 953
diff changeset
115 /* specials: */
2238
9cc23c29aaec Added a framework for getting POP3 UIDL strings from mail-storage. The
Timo Sirainen <tss@iki.fi>
parents: 2219
diff changeset
116 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
117 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
118 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
119 MAIL_FETCH_FROM_ENVELOPE = 0x00008000,
2996
9219e788d774 Added %f pop3_uidl_format for maildir. Patch by Andrey Panin.
Timo Sirainen <tss@iki.fi>
parents: 2976
diff changeset
120 MAIL_FETCH_HEADER_MD5 = 0x00010000,
9219e788d774 Added %f pop3_uidl_format for maildir. Patch by Andrey Panin.
Timo Sirainen <tss@iki.fi>
parents: 2976
diff changeset
121 MAIL_FETCH_UIDL_FILE_NAME = 0x00020000
988
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 953
diff changeset
122 };
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 953
diff changeset
123
3209
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3207
diff changeset
124 enum mailbox_transaction_flags {
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3207
diff changeset
125 /* Hide changes done in this transaction from next view sync */
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3207
diff changeset
126 MAILBOX_TRANSACTION_FLAG_HIDE = 0x01,
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3207
diff changeset
127 /* External transaction. Should be used for copying and appends,
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3207
diff changeset
128 but nothing else. */
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3207
diff changeset
129 MAILBOX_TRANSACTION_FLAG_EXTERNAL = 0x02
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3207
diff changeset
130 };
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3207
diff changeset
131
1730
8480f945e270 IDLE uses now IO_*_NOTIFY to get instant notifying of mails.
Timo Sirainen <tss@iki.fi>
parents: 1728
diff changeset
132 enum mailbox_sync_flags {
2665
ccf563859be5 Split sync_flag_full into sync_flag_full_read and _write. Closing mailbox
Timo Sirainen <tss@iki.fi>
parents: 2589
diff changeset
133 /* Make sure we sync all external changes done to mailbox */
ccf563859be5 Split sync_flag_full into sync_flag_full_read and _write. Closing mailbox
Timo Sirainen <tss@iki.fi>
parents: 2589
diff changeset
134 MAILBOX_SYNC_FLAG_FULL_READ = 0x01,
ccf563859be5 Split sync_flag_full into sync_flag_full_read and _write. Closing mailbox
Timo Sirainen <tss@iki.fi>
parents: 2589
diff changeset
135 /* Make sure we write all our internal changes into the mailbox */
ccf563859be5 Split sync_flag_full into sync_flag_full_read and _write. Closing mailbox
Timo Sirainen <tss@iki.fi>
parents: 2589
diff changeset
136 MAILBOX_SYNC_FLAG_FULL_WRITE = 0x02,
ccf563859be5 Split sync_flag_full into sync_flag_full_read and _write. Closing mailbox
Timo Sirainen <tss@iki.fi>
parents: 2589
diff changeset
137 /* If it's not too much trouble, check if there are some changes */
ccf563859be5 Split sync_flag_full into sync_flag_full_read and _write. Closing mailbox
Timo Sirainen <tss@iki.fi>
parents: 2589
diff changeset
138 MAILBOX_SYNC_FLAG_FAST = 0x04,
ccf563859be5 Split sync_flag_full into sync_flag_full_read and _write. Closing mailbox
Timo Sirainen <tss@iki.fi>
parents: 2589
diff changeset
139
ccf563859be5 Split sync_flag_full into sync_flag_full_read and _write. Closing mailbox
Timo Sirainen <tss@iki.fi>
parents: 2589
diff changeset
140 /* Don't sync expunges from our view */
ccf563859be5 Split sync_flag_full into sync_flag_full_read and _write. Closing mailbox
Timo Sirainen <tss@iki.fi>
parents: 2589
diff changeset
141 MAILBOX_SYNC_FLAG_NO_EXPUNGES = 0x08,
3204
c8fffa286b6a Renamed oe6-fetch-no-newmail workaround to delay-newmail and changed it to
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
142 /* Don't show new mail */
c8fffa286b6a Renamed oe6-fetch-no-newmail workaround to delay-newmail and changed it to
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
143 MAILBOX_SYNC_FLAG_NO_NEWMAIL = 0x10,
2665
ccf563859be5 Split sync_flag_full into sync_flag_full_read and _write. Closing mailbox
Timo Sirainen <tss@iki.fi>
parents: 2589
diff changeset
144 /* Stop auto syncing */
3204
c8fffa286b6a Renamed oe6-fetch-no-newmail workaround to delay-newmail and changed it to
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
145 MAILBOX_SYNC_AUTO_STOP = 0x20
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
146 };
bc3307f2f35d Only NOOP and CHECK will now always do a real mailbox sync. Other commands
Timo Sirainen <tss@iki.fi>
parents: 1534
diff changeset
147
2322
aae574ed7f4c Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents: 2316
diff changeset
148 enum mailbox_sync_type {
aae574ed7f4c Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents: 2316
diff changeset
149 MAILBOX_SYNC_TYPE_EXPUNGE = 0x01,
3016
61c8d205d887 Initial support for keywords. Syncing to mbox/maildir doesn't work yet.
Timo Sirainen <tss@iki.fi>
parents: 2996
diff changeset
150 MAILBOX_SYNC_TYPE_FLAGS = 0x02,
61c8d205d887 Initial support for keywords. Syncing to mbox/maildir doesn't work yet.
Timo Sirainen <tss@iki.fi>
parents: 2996
diff changeset
151 MAILBOX_SYNC_TYPE_KEYWORDS = 0x04
2322
aae574ed7f4c Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents: 2316
diff changeset
152 };
aae574ed7f4c Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents: 2316
diff changeset
153
903
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 889
diff changeset
154 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
155 struct mail_search_arg;
3016
61c8d205d887 Initial support for keywords. Syncing to mbox/maildir doesn't work yet.
Timo Sirainen <tss@iki.fi>
parents: 2996
diff changeset
156 struct mail_keywords;
4044
da1d65e064f8 mailbox_save_init() supports now returning failure. Quota plugin now checks
Timo Sirainen <timo.sirainen@movial.fi>
parents: 4041
diff changeset
157 struct mail_save_context;
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
158 struct mailbox;
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
159 struct mailbox_list_context;
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
160 struct mailbox_transaction_context;
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
161
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
162 struct mailbox_list {
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
163 const char *name;
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
164 enum mailbox_flags flags;
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
165 };
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
166
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
167 struct mailbox_status {
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
168 uint32_t messages;
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
169 uint32_t recent;
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
170 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
171
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
172 uint32_t uidvalidity;
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
173 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
174
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
175 uint32_t first_unseen_seq;
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
176
3254
a2943c050571 Keywords are now stored in X-Keywords headers in mbox. Did several related
Timo Sirainen <tss@iki.fi>
parents: 3248
diff changeset
177 const array_t *ARRAY_DEFINE_PTR(keywords, const char *);
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
178 };
450
925d6eb5f8be MailStorage interface change. We now let storage call several sync-functions
Timo Sirainen <tss@iki.fi>
parents: 410
diff changeset
179
2322
aae574ed7f4c Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents: 2316
diff changeset
180 struct mailbox_sync_rec {
aae574ed7f4c Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents: 2316
diff changeset
181 uint32_t seq1, seq2;
aae574ed7f4c Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents: 2316
diff changeset
182 enum mailbox_sync_type type;
aae574ed7f4c Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents: 2316
diff changeset
183 };
aae574ed7f4c Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents: 2316
diff changeset
184
3209
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3207
diff changeset
185 struct mail {
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3207
diff changeset
186 /* always set */
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3207
diff changeset
187 struct mailbox *box;
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3207
diff changeset
188 struct mailbox_transaction_context *transaction;
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3207
diff changeset
189 uint32_t seq, uid;
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3207
diff changeset
190
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3207
diff changeset
191 unsigned int expunged:1;
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3207
diff changeset
192 unsigned int has_nuls:1; /* message data is known to contain NULs */
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3207
diff changeset
193 unsigned int has_no_nuls:1; /* -''- known to not contain NULs */
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3207
diff changeset
194 };
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3207
diff changeset
195
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
196 struct mail_storage_callbacks {
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
197 /* Alert: Not enough disk space */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
198 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
199 /* "* OK <text>" */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
200 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
201 void *context);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
202 /* "* NO <text>" */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
203 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
204 void *context);
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
205
2322
aae574ed7f4c Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents: 2316
diff changeset
206 };
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
207
2322
aae574ed7f4c Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents: 2316
diff changeset
208 typedef void mailbox_notify_callback_t(struct mailbox *box, void *context);
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
209
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
210 void mail_storage_init(void);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
211 void mail_storage_deinit(void);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
212
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
213 /* register all mail storages */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
214 void mail_storage_register_all(void);
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
215
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
216 /* 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
217 are set to default methods */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
218 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
219 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
220
3971
539a58176e7b Moved mailbox flag and lock method parsing to lib-storage.
Timo Sirainen <tss@iki.fi>
parents: 3879
diff changeset
221 /* Returns flags and lock_method based on environment settings. */
539a58176e7b Moved mailbox flag and lock method parsing to lib-storage.
Timo Sirainen <tss@iki.fi>
parents: 3879
diff changeset
222 void mail_storage_parse_env(enum mail_storage_flags *flags_r,
539a58176e7b Moved mailbox flag and lock method parsing to lib-storage.
Timo Sirainen <tss@iki.fi>
parents: 3879
diff changeset
223 enum mail_storage_lock_method *lock_method_r);
539a58176e7b Moved mailbox flag and lock method parsing to lib-storage.
Timo Sirainen <tss@iki.fi>
parents: 3879
diff changeset
224
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
225 /* 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
226 storage-specific data. If data is NULL, it tries to use defaults.
4076
7f48190f868f Moved mailbox_list_flags to struct mailbox_list_context so plugins can see the flags more easily.
Timo Sirainen <timo.sirainen@movial.fi>
parents: 4044
diff changeset
227 May return NULL if anything fails. */
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
228 struct mail_storage *
3033
146897976cfa Added mail_debug setting. Moved full_filesystem_access from global variable
Timo Sirainen <tss@iki.fi>
parents: 3016
diff changeset
229 mail_storage_create(const char *name, const char *data, const char *user,
3260
6a179bf1272e Moved several getenv()s from lib-storage to main code. deliver binary was
Timo Sirainen <tss@iki.fi>
parents: 3254
diff changeset
230 enum mail_storage_flags flags,
6a179bf1272e Moved several getenv()s from lib-storage to main code. deliver binary was
Timo Sirainen <tss@iki.fi>
parents: 3254
diff changeset
231 enum mail_storage_lock_method lock_method);
3879
928229f8b3e6 deinit, unref, destroy, close, free, etc. functions now take a pointer to
Timo Sirainen <tss@iki.fi>
parents: 3863
diff changeset
232 void mail_storage_destroy(struct mail_storage **storage);
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
233
3033
146897976cfa Added mail_debug setting. Moved full_filesystem_access from global variable
Timo Sirainen <tss@iki.fi>
parents: 3016
diff changeset
234 struct mail_storage *
3260
6a179bf1272e Moved several getenv()s from lib-storage to main code. deliver binary was
Timo Sirainen <tss@iki.fi>
parents: 3254
diff changeset
235 mail_storage_create_default(const char *user, enum mail_storage_flags flags,
6a179bf1272e Moved several getenv()s from lib-storage to main code. deliver binary was
Timo Sirainen <tss@iki.fi>
parents: 3254
diff changeset
236 enum mail_storage_lock_method lock_method);
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
237 struct mail_storage *
3033
146897976cfa Added mail_debug setting. Moved full_filesystem_access from global variable
Timo Sirainen <tss@iki.fi>
parents: 3016
diff changeset
238 mail_storage_create_with_data(const char *data, const char *user,
3260
6a179bf1272e Moved several getenv()s from lib-storage to main code. deliver binary was
Timo Sirainen <tss@iki.fi>
parents: 3254
diff changeset
239 enum mail_storage_flags flags,
6a179bf1272e Moved several getenv()s from lib-storage to main code. deliver binary was
Timo Sirainen <tss@iki.fi>
parents: 3254
diff changeset
240 enum mail_storage_lock_method lock_method);
1639
3621292209f4 Explicit lock() method for mailbox.
Timo Sirainen <tss@iki.fi>
parents: 1638
diff changeset
241
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
242 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
243
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
244 /* Set storage callback functions to use. */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
245 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
246 struct mail_storage_callbacks *callbacks,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
247 void *context);
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
248
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
249 /* 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
250 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
251 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
252 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
253 int mail_storage_mailbox_create(struct mail_storage *storage, const char *name,
3863
55df57c028d4 Added "bool" type and changed all ints that were used as booleans to bool.
Timo Sirainen <tss@iki.fi>
parents: 3641
diff changeset
254 bool directory);
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
255 /* 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
256 specified mailbox must not be deleted. */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
257 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
258 /* 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
259 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
260 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
261 hierarchies.
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
262
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
263 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
264 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
265 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
266 const char *oldname, const char *newname);
1172
f7c273202dc3 Support for IDLE extension.
Timo Sirainen <tss@iki.fi>
parents: 1151
diff changeset
267
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
268 /* Initialize new mailbox list request. mask may contain '%' and '*'
2350
1371d41c375f Moved namespace and hierarchy separator handling to imap-specific code. LIST
Timo Sirainen <tss@iki.fi>
parents: 2327
diff changeset
269 wildcards as defined in RFC3501. Matching against "INBOX" is
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
270 case-insensitive, but anything else is not. */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
271 struct mailbox_list_context *
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
272 mail_storage_mailbox_list_init(struct mail_storage *storage,
2350
1371d41c375f Moved namespace and hierarchy separator handling to imap-specific code. LIST
Timo Sirainen <tss@iki.fi>
parents: 2327
diff changeset
273 const char *ref, const char *mask,
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
274 enum mailbox_list_flags flags);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
275 /* Get next mailbox. Returns the mailbox name */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
276 struct mailbox_list *
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
277 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
278 /* Deinitialize mailbox list request. Returns FALSE if some error
3520
e2fe8222449d s/occured/occurred/
Timo Sirainen <tss@iki.fi>
parents: 3517
diff changeset
279 occurred while listing. */
3879
928229f8b3e6 deinit, unref, destroy, close, free, etc. functions now take a pointer to
Timo Sirainen <tss@iki.fi>
parents: 3863
diff changeset
280 int mail_storage_mailbox_list_deinit(struct mailbox_list_context **ctx);
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
281
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
282 /* 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
283 subscribing to already subscribed mailbox. Subscribing to
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
284 unexisting mailboxes is optional. */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
285 int mail_storage_set_subscribed(struct mail_storage *storage,
3863
55df57c028d4 Added "bool" type and changed all ints that were used as booleans to bool.
Timo Sirainen <tss@iki.fi>
parents: 3641
diff changeset
286 const char *name, bool set);
988
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 953
diff changeset
287
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
288 /* Returns mailbox name status */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
289 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
290 const char *name,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
291 enum mailbox_name_status *status);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
292
3520
e2fe8222449d s/occured/occurred/
Timo Sirainen <tss@iki.fi>
parents: 3517
diff changeset
293 /* Returns the error message of last occurred error. */
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
294 const char *mail_storage_get_last_error(struct mail_storage *storage,
3863
55df57c028d4 Added "bool" type and changed all ints that were used as booleans to bool.
Timo Sirainen <tss@iki.fi>
parents: 3641
diff changeset
295 bool *syntax_error_r,
55df57c028d4 Added "bool" type and changed all ints that were used as booleans to bool.
Timo Sirainen <tss@iki.fi>
parents: 3641
diff changeset
296 bool *temporary_error_r);
988
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 953
diff changeset
297
4041
9d7420b0e1ef Make life easier for plugins:
Timo Sirainen <timo.sirainen@movial.fi>
parents: 3971
diff changeset
298 /* Returns path to the given mailbox, or NULL if mailbox doesn't exist in
9d7420b0e1ef Make life easier for plugins:
Timo Sirainen <timo.sirainen@movial.fi>
parents: 3971
diff changeset
299 filesystem. is_file_r is set to TRUE if returned path points to a file,
9d7420b0e1ef Make life easier for plugins:
Timo Sirainen <timo.sirainen@movial.fi>
parents: 3971
diff changeset
300 and FALSE if it points to a directory. If name is "", the root storage
9d7420b0e1ef Make life easier for plugins:
Timo Sirainen <timo.sirainen@movial.fi>
parents: 3971
diff changeset
301 directory is returned. */
9d7420b0e1ef Make life easier for plugins:
Timo Sirainen <timo.sirainen@movial.fi>
parents: 3971
diff changeset
302 const char *mail_storage_get_mailbox_path(struct mail_storage *storage,
9d7420b0e1ef Make life easier for plugins:
Timo Sirainen <timo.sirainen@movial.fi>
parents: 3971
diff changeset
303 const char *name, bool *is_file_r);
9d7420b0e1ef Make life easier for plugins:
Timo Sirainen <timo.sirainen@movial.fi>
parents: 3971
diff changeset
304 /* Returns path to the control directory of the mailbox, or NULL if mailbox
9d7420b0e1ef Make life easier for plugins:
Timo Sirainen <timo.sirainen@movial.fi>
parents: 3971
diff changeset
305 doesn't exist in filesystem. */
9d7420b0e1ef Make life easier for plugins:
Timo Sirainen <timo.sirainen@movial.fi>
parents: 3971
diff changeset
306 const char *mail_storage_get_mailbox_control_dir(struct mail_storage *storage,
9d7420b0e1ef Make life easier for plugins:
Timo Sirainen <timo.sirainen@movial.fi>
parents: 3971
diff changeset
307 const char *name);
9d7420b0e1ef Make life easier for plugins:
Timo Sirainen <timo.sirainen@movial.fi>
parents: 3971
diff changeset
308
3245
6491dab63e54 Added input stream parameter to mailbox_open(). With mbox it now allows
Timo Sirainen <tss@iki.fi>
parents: 3209
diff changeset
309 /* Open a mailbox. If input stream is given, mailbox is opened read-only
6491dab63e54 Added input stream parameter to mailbox_open(). With mbox it now allows
Timo Sirainen <tss@iki.fi>
parents: 3209
diff changeset
310 using it as a backend. If storage doesn't support stream backends and its
6491dab63e54 Added input stream parameter to mailbox_open(). With mbox it now allows
Timo Sirainen <tss@iki.fi>
parents: 3209
diff changeset
311 tried to be used, NULL is returned.
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
312
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
313 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
314 with possibly different readonly-state. */
3245
6491dab63e54 Added input stream parameter to mailbox_open(). With mbox it now allows
Timo Sirainen <tss@iki.fi>
parents: 3209
diff changeset
315 struct mailbox *mailbox_open(struct mail_storage *storage, const char *name,
6491dab63e54 Added input stream parameter to mailbox_open(). With mbox it now allows
Timo Sirainen <tss@iki.fi>
parents: 3209
diff changeset
316 struct istream *input,
6491dab63e54 Added input stream parameter to mailbox_open(). With mbox it now allows
Timo Sirainen <tss@iki.fi>
parents: 3209
diff changeset
317 enum mailbox_open_flags flags);
3863
55df57c028d4 Added "bool" type and changed all ints that were used as booleans to bool.
Timo Sirainen <tss@iki.fi>
parents: 3641
diff changeset
318 /* Close the box. Returns -1 if some cleanup errors occurred, but
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
319 the mailbox was closed anyway. */
3879
928229f8b3e6 deinit, unref, destroy, close, free, etc. functions now take a pointer to
Timo Sirainen <tss@iki.fi>
parents: 3863
diff changeset
320 int mailbox_close(struct mailbox **box);
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
321
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
322 /* Returns storage of given mailbox */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
323 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
324
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
325 /* Returns name of given mailbox */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
326 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
327
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
328 /* Returns TRUE if mailbox is read-only. */
3863
55df57c028d4 Added "bool" type and changed all ints that were used as booleans to bool.
Timo Sirainen <tss@iki.fi>
parents: 3641
diff changeset
329 bool mailbox_is_readonly(struct mailbox *box);
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
330
1958
4dec6a3d79fd s/custom flags/keywords/
Timo Sirainen <tss@iki.fi>
parents: 1917
diff changeset
331 /* Returns TRUE if mailbox currently supports adding keywords. */
3863
55df57c028d4 Added "bool" type and changed all ints that were used as booleans to bool.
Timo Sirainen <tss@iki.fi>
parents: 3641
diff changeset
332 bool 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
333
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
334 /* Gets the mailbox status information. */
2350
1371d41c375f Moved namespace and hierarchy separator handling to imap-specific code. LIST
Timo Sirainen <tss@iki.fi>
parents: 2327
diff changeset
335 int mailbox_get_status(struct mailbox *box, enum mailbox_status_items items,
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
336 struct mailbox_status *status);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
337
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
338 /* Synchronize the mailbox. */
2322
aae574ed7f4c Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents: 2316
diff changeset
339 struct mailbox_sync_context *
aae574ed7f4c Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents: 2316
diff changeset
340 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
341 int mailbox_sync_next(struct mailbox_sync_context *ctx,
aae574ed7f4c Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents: 2316
diff changeset
342 struct mailbox_sync_rec *sync_rec_r);
3879
928229f8b3e6 deinit, unref, destroy, close, free, etc. functions now take a pointer to
Timo Sirainen <tss@iki.fi>
parents: 3863
diff changeset
343 int mailbox_sync_deinit(struct mailbox_sync_context **ctx,
2322
aae574ed7f4c Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents: 2316
diff changeset
344 struct mailbox_status *status_r);
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
345
2322
aae574ed7f4c Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents: 2316
diff changeset
346 /* 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
347 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
348 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
349 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
350
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
351 struct mailbox_transaction_context *
3209
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3207
diff changeset
352 mailbox_transaction_begin(struct mailbox *box,
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3207
diff changeset
353 enum mailbox_transaction_flags flags);
3879
928229f8b3e6 deinit, unref, destroy, close, free, etc. functions now take a pointer to
Timo Sirainen <tss@iki.fi>
parents: 3863
diff changeset
354 int mailbox_transaction_commit(struct mailbox_transaction_context **t,
2518
f8be7a5e273a Added sync flags parameter to mailbox_transaction_commit(), so EXPUNGE can
Timo Sirainen <tss@iki.fi>
parents: 2511
diff changeset
355 enum mailbox_sync_flags flags);
3879
928229f8b3e6 deinit, unref, destroy, close, free, etc. functions now take a pointer to
Timo Sirainen <tss@iki.fi>
parents: 3863
diff changeset
356 void mailbox_transaction_rollback(struct mailbox_transaction_context **t);
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
357
3016
61c8d205d887 Initial support for keywords. Syncing to mbox/maildir doesn't work yet.
Timo Sirainen <tss@iki.fi>
parents: 2996
diff changeset
358 /* Build mail_keywords from NULL-terminated keywords list. */
61c8d205d887 Initial support for keywords. Syncing to mbox/maildir doesn't work yet.
Timo Sirainen <tss@iki.fi>
parents: 2996
diff changeset
359 struct mail_keywords *
61c8d205d887 Initial support for keywords. Syncing to mbox/maildir doesn't work yet.
Timo Sirainen <tss@iki.fi>
parents: 2996
diff changeset
360 mailbox_keywords_create(struct mailbox_transaction_context *t,
61c8d205d887 Initial support for keywords. Syncing to mbox/maildir doesn't work yet.
Timo Sirainen <tss@iki.fi>
parents: 2996
diff changeset
361 const char *const keywords[]);
3138
fbe844061fe2 Internal changes in how keywords are handled. struct mail_keywords isn't
Timo Sirainen <tss@iki.fi>
parents: 3086
diff changeset
362 void mailbox_keywords_free(struct mailbox_transaction_context *t,
3879
928229f8b3e6 deinit, unref, destroy, close, free, etc. functions now take a pointer to
Timo Sirainen <tss@iki.fi>
parents: 3863
diff changeset
363 struct mail_keywords **keywords);
3016
61c8d205d887 Initial support for keywords. Syncing to mbox/maildir doesn't work yet.
Timo Sirainen <tss@iki.fi>
parents: 2996
diff changeset
364
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
365 /* Convert uid range to sequence range. */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
366 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
367 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
368
2327
7d02e2a7672d Header caching redesigned. New design allows caching decisions per field, so
Timo Sirainen <tss@iki.fi>
parents: 2322
diff changeset
369 /* 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
370 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
371 mailbox_header_lookup_init(struct mailbox *box, const char *const headers[]);
3879
928229f8b3e6 deinit, unref, destroy, close, free, etc. functions now take a pointer to
Timo Sirainen <tss@iki.fi>
parents: 3863
diff changeset
372 void mailbox_header_lookup_deinit(struct mailbox_header_lookup_ctx **ctx);
2327
7d02e2a7672d Header caching redesigned. New design allows caching decisions per field, so
Timo Sirainen <tss@iki.fi>
parents: 2322
diff changeset
373
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
374 /* 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
375 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
376 {MAIL_SORT_END}. */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
377 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
378 enum mail_sort_type *sort_program);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
379 /* 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
380 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
381
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
382 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
383 are sorted by the given criteria. sort_program must have gone
3209
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3207
diff changeset
384 through search_get_sorting(). */
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
385 struct mail_search_context *
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
386 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
387 const char *charset, struct mail_search_arg *args,
3209
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3207
diff changeset
388 const enum mail_sort_type *sort_program);
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
389 /* Deinitialize search request. */
3879
928229f8b3e6 deinit, unref, destroy, close, free, etc. functions now take a pointer to
Timo Sirainen <tss@iki.fi>
parents: 3863
diff changeset
390 int mailbox_search_deinit(struct mail_search_context **ctx);
3209
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3207
diff changeset
391 /* Search the next message. Returns 1 if found, 0 if not, -1 if failure. */
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3207
diff changeset
392 int mailbox_search_next(struct mail_search_context *ctx, struct mail *mail);
1637
a64391b49589 API change for copying messages.
Timo Sirainen <tss@iki.fi>
parents: 1622
diff changeset
393
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
394 /* 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
395 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
396 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
397
2446
47e1e05cede0 Changed mail saving API to be nonblocking.
Timo Sirainen <tss@iki.fi>
parents: 2422
diff changeset
398 If want_mail is TRUE, mail_r will be set in mailbox_save_finish() and
47e1e05cede0 Changed mail saving API to be nonblocking.
Timo Sirainen <tss@iki.fi>
parents: 2422
diff changeset
399 the saved message can be accessed using it. Note that setting it may
47e1e05cede0 Changed mail saving API to be nonblocking.
Timo Sirainen <tss@iki.fi>
parents: 2422
diff changeset
400 require mailbox syncing, so don't set it unless you need it. */
4044
da1d65e064f8 mailbox_save_init() supports now returning failure. Quota plugin now checks
Timo Sirainen <timo.sirainen@movial.fi>
parents: 4041
diff changeset
401 int mailbox_save_init(struct mailbox_transaction_context *t,
da1d65e064f8 mailbox_save_init() supports now returning failure. Quota plugin now checks
Timo Sirainen <timo.sirainen@movial.fi>
parents: 4041
diff changeset
402 enum mail_flags flags, struct mail_keywords *keywords,
da1d65e064f8 mailbox_save_init() supports now returning failure. Quota plugin now checks
Timo Sirainen <timo.sirainen@movial.fi>
parents: 4041
diff changeset
403 time_t received_date, int timezone_offset,
da1d65e064f8 mailbox_save_init() supports now returning failure. Quota plugin now checks
Timo Sirainen <timo.sirainen@movial.fi>
parents: 4041
diff changeset
404 const char *from_envelope, struct istream *input,
da1d65e064f8 mailbox_save_init() supports now returning failure. Quota plugin now checks
Timo Sirainen <timo.sirainen@movial.fi>
parents: 4041
diff changeset
405 bool want_mail, struct mail_save_context **ctx_r);
2446
47e1e05cede0 Changed mail saving API to be nonblocking.
Timo Sirainen <tss@iki.fi>
parents: 2422
diff changeset
406 int mailbox_save_continue(struct mail_save_context *ctx);
3879
928229f8b3e6 deinit, unref, destroy, close, free, etc. functions now take a pointer to
Timo Sirainen <tss@iki.fi>
parents: 3863
diff changeset
407 int mailbox_save_finish(struct mail_save_context **ctx, struct mail *dest_mail);
928229f8b3e6 deinit, unref, destroy, close, free, etc. functions now take a pointer to
Timo Sirainen <tss@iki.fi>
parents: 3863
diff changeset
408 void mailbox_save_cancel(struct mail_save_context **ctx);
2446
47e1e05cede0 Changed mail saving API to be nonblocking.
Timo Sirainen <tss@iki.fi>
parents: 2422
diff changeset
409
3209
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3207
diff changeset
410 /* Copy given message. If dest_mail is non-NULL, the copied message can be
2190
755ec9442a58 mailbox_save() and mailbox_copy() functions can now return the saved mail so
Timo Sirainen <tss@iki.fi>
parents: 2062
diff changeset
411 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
412 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
413 int mailbox_copy(struct mailbox_transaction_context *t, struct mail *mail,
3641
3de464cb604f Added flags and keywords parameters to mailbox_copy() in case they're wanted
Timo Sirainen <tss@iki.fi>
parents: 3628
diff changeset
414 enum mail_flags flags, struct mail_keywords *keywords,
3209
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3207
diff changeset
415 struct mail *dest_mail);
1640
db14aa8e2b5c API change for expunging messages. Not exactly what I wanted, but good
Timo Sirainen <tss@iki.fi>
parents: 1639
diff changeset
416
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents: 1845
diff changeset
417 /* 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
418 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
419 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
420 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
421 do forced CLOSE. */
3863
55df57c028d4 Added "bool" type and changed all ints that were used as booleans to bool.
Timo Sirainen <tss@iki.fi>
parents: 3641
diff changeset
422 bool mailbox_is_inconsistent(struct mailbox *box);
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
423
3209
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3207
diff changeset
424 /* Returns message's flags */
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3207
diff changeset
425 enum mail_flags mail_get_flags(struct mail *mail);
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3207
diff changeset
426 /* Returns message's keywords */
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3207
diff changeset
427 const char *const *mail_get_keywords(struct mail *mail);
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3207
diff changeset
428 /* Returns message's MIME parts */
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3207
diff changeset
429 const struct message_part *mail_get_parts(struct mail *mail);
988
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 953
diff changeset
430
3209
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3207
diff changeset
431 struct mail *mail_alloc(struct mailbox_transaction_context *t,
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3207
diff changeset
432 enum mail_fetch_field wanted_fields,
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3207
diff changeset
433 struct mailbox_header_lookup_ctx *wanted_headers);
3879
928229f8b3e6 deinit, unref, destroy, close, free, etc. functions now take a pointer to
Timo Sirainen <tss@iki.fi>
parents: 3863
diff changeset
434 void mail_free(struct mail **mail);
3209
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3207
diff changeset
435 int mail_set_seq(struct mail *mail, uint32_t seq);
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3207
diff changeset
436
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3207
diff changeset
437 /* Get the time message was received (IMAP INTERNALDATE).
3520
e2fe8222449d s/occured/occurred/
Timo Sirainen <tss@iki.fi>
parents: 3517
diff changeset
438 Returns (time_t)-1 if error occurred. */
3209
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3207
diff changeset
439 time_t mail_get_received_date(struct mail *mail);
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3207
diff changeset
440 /* Get the Date-header in mail. Timezone is in minutes.
3520
e2fe8222449d s/occured/occurred/
Timo Sirainen <tss@iki.fi>
parents: 3517
diff changeset
441 Returns (time_t)-1 if error occurred, 0 if field wasn't found or
3209
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3207
diff changeset
442 couldn't be parsed. */
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3207
diff changeset
443 time_t mail_get_date(struct mail *mail, int *timezone);
988
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 953
diff changeset
444
3209
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3207
diff changeset
445 /* Get the full virtual size of mail (IMAP RFC822.SIZE).
3520
e2fe8222449d s/occured/occurred/
Timo Sirainen <tss@iki.fi>
parents: 3517
diff changeset
446 Returns (uoff_t)-1 if error occurred */
3209
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3207
diff changeset
447 uoff_t mail_get_virtual_size(struct mail *mail);
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3207
diff changeset
448 /* Get the full physical size of mail.
3520
e2fe8222449d s/occured/occurred/
Timo Sirainen <tss@iki.fi>
parents: 3517
diff changeset
449 Returns (uoff_t)-1 if error occurred */
3209
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3207
diff changeset
450 uoff_t mail_get_physical_size(struct mail *mail);
988
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 953
diff changeset
451
3209
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3207
diff changeset
452 /* Get value for single header field */
3248
ff47e78ad717 Renamed mail_get_header() to mail_get_first_header() and mail_gets_headers()
Timo Sirainen <tss@iki.fi>
parents: 3245
diff changeset
453 const char *mail_get_first_header(struct mail *mail, const char *field);
ff47e78ad717 Renamed mail_get_header() to mail_get_first_header() and mail_gets_headers()
Timo Sirainen <tss@iki.fi>
parents: 3245
diff changeset
454 /* Return a NULL-terminated list of values for each found field. */
ff47e78ad717 Renamed mail_get_header() to mail_get_first_header() and mail_gets_headers()
Timo Sirainen <tss@iki.fi>
parents: 3245
diff changeset
455 const char *const *mail_get_headers(struct mail *mail, const char *field);
3209
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3207
diff changeset
456 /* Returns stream containing specified headers. */
3248
ff47e78ad717 Renamed mail_get_header() to mail_get_first_header() and mail_gets_headers()
Timo Sirainen <tss@iki.fi>
parents: 3245
diff changeset
457 struct istream *
ff47e78ad717 Renamed mail_get_header() to mail_get_first_header() and mail_gets_headers()
Timo Sirainen <tss@iki.fi>
parents: 3245
diff changeset
458 mail_get_header_stream(struct mail *mail,
ff47e78ad717 Renamed mail_get_header() to mail_get_first_header() and mail_gets_headers()
Timo Sirainen <tss@iki.fi>
parents: 3245
diff changeset
459 struct mailbox_header_lookup_ctx *headers);
3209
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3207
diff changeset
460 /* Returns input stream pointing to beginning of message header.
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3207
diff changeset
461 hdr_size and body_size are updated unless they're NULL. */
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3207
diff changeset
462 struct istream *mail_get_stream(struct mail *mail,
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3207
diff changeset
463 struct message_size *hdr_size,
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3207
diff changeset
464 struct message_size *body_size);
1637
a64391b49589 API change for copying messages.
Timo Sirainen <tss@iki.fi>
parents: 1622
diff changeset
465
3209
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3207
diff changeset
466 /* Get any of the "special" fields. */
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3207
diff changeset
467 const char *mail_get_special(struct mail *mail, enum mail_fetch_field field);
1638
e95c0e462591 API change for updating message flags.
Timo Sirainen <tss@iki.fi>
parents: 1637
diff changeset
468
3209
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3207
diff changeset
469 /* Update message flags. */
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3207
diff changeset
470 int mail_update_flags(struct mail *mail, enum modify_type modify_type,
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3207
diff changeset
471 enum mail_flags flags);
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3207
diff changeset
472 /* Update message keywords. */
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3207
diff changeset
473 int mail_update_keywords(struct mail *mail, enum modify_type modify_type,
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3207
diff changeset
474 struct mail_keywords *keywords);
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3207
diff changeset
475
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3207
diff changeset
476 /* Expunge this message. Sequence numbers don't change until commit. */
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3207
diff changeset
477 int mail_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
478
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
479 #endif