Mercurial > dovecot > original-hg > dovecot-1.2
annotate src/lib-storage/mail-storage.h @ 9354:687ac828b964 HEAD
lib-index: modseqs weren't tracked properly within session when changes were done.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Tue, 01 Sep 2009 13:05:03 -0400 |
parents | 3eacb6bbd227 |
children | a5d8d201bd39 |
rev | line source |
---|---|
6410
e4eb71ae8e96
Changed .h ifdef/defines to use <NAME>_H format.
Timo Sirainen <tss@iki.fi>
parents:
6354
diff
changeset
|
1 #ifndef MAIL_STORAGE_H |
e4eb71ae8e96
Changed .h ifdef/defines to use <NAME>_H format.
Timo Sirainen <tss@iki.fi>
parents:
6354
diff
changeset
|
2 #define MAIL_STORAGE_H |
0 | 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 |
7629 | 6 #include "seq-range-array.h" |
6503 | 7 #include "file-lock.h" |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
1845
diff
changeset
|
8 #include "mail-types.h" |
5613 | 9 #include "mail-error.h" |
4808
93bc9770f938
Initial code for separation of mailbox accessing and directory layout
Timo Sirainen <tss@iki.fi>
parents:
4646
diff
changeset
|
10 #include "mailbox-list.h" |
0 | 11 |
5368
7d45edb81fe4
When copying/syncing a lot of mails, send "* OK Hang in there" replies to
Timo Sirainen <tss@iki.fi>
parents:
5032
diff
changeset
|
12 /* If some operation is taking long, call notify_ok every n seconds. */ |
7d45edb81fe4
When copying/syncing a lot of mails, send "* OK Hang in there" replies to
Timo Sirainen <tss@iki.fi>
parents:
5032
diff
changeset
|
13 #define MAIL_STORAGE_STAYALIVE_SECS 15 |
7d45edb81fe4
When copying/syncing a lot of mails, send "* OK Hang in there" replies to
Timo Sirainen <tss@iki.fi>
parents:
5032
diff
changeset
|
14 |
3033
146897976cfa
Added mail_debug setting. Moved full_filesystem_access from global variable
Timo Sirainen <tss@iki.fi>
parents:
3016
diff
changeset
|
15 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
|
16 /* 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
|
17 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
|
18 /* 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
|
19 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
|
20 /* 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
|
21 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
|
22 /* 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
|
23 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
|
24 (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
|
25 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
|
26 /* 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
|
27 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
|
28 /* 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
|
29 MAIL_STORAGE_FLAG_SAVE_CRLF = 0x40, |
4646
6c607dbab732
If the mail environment data contains mail format prefix, don't do any kind
Timo Sirainen <tss@iki.fi>
parents:
4613
diff
changeset
|
30 /* Don't try to autodetect anything, require that the given data |
6c607dbab732
If the mail environment data contains mail format prefix, don't do any kind
Timo Sirainen <tss@iki.fi>
parents:
4613
diff
changeset
|
31 contains all the necessary information. */ |
4808
93bc9770f938
Initial code for separation of mailbox accessing and directory layout
Timo Sirainen <tss@iki.fi>
parents:
4646
diff
changeset
|
32 MAIL_STORAGE_FLAG_NO_AUTODETECTION = 0x100, |
4859
92c0994a1fcf
Added MAIL_STORAGE_FLAG_NO_AUTOCREATE flag which silently fails storage
Timo Sirainen <tss@iki.fi>
parents:
4848
diff
changeset
|
33 /* Don't autocreate any directories. If they don't exist, |
92c0994a1fcf
Added MAIL_STORAGE_FLAG_NO_AUTOCREATE flag which silently fails storage
Timo Sirainen <tss@iki.fi>
parents:
4848
diff
changeset
|
34 fail to create the storage. */ |
92c0994a1fcf
Added MAIL_STORAGE_FLAG_NO_AUTOCREATE flag which silently fails storage
Timo Sirainen <tss@iki.fi>
parents:
4848
diff
changeset
|
35 MAIL_STORAGE_FLAG_NO_AUTOCREATE = 0x200, |
4968
1baf9dd3fc40
Added dotlock_use_excl setting.
Timo Sirainen <tss@iki.fi>
parents:
4939
diff
changeset
|
36 /* Rely on O_EXCL when creating dotlocks */ |
5973
fe9da9c92cf4
Added MAIL_STORAGE_FLAG_NFS_FLUSH_STORAGE and
Timo Sirainen <tss@iki.fi>
parents:
5949
diff
changeset
|
37 MAIL_STORAGE_FLAG_DOTLOCK_USE_EXCL = 0x400, |
fe9da9c92cf4
Added MAIL_STORAGE_FLAG_NFS_FLUSH_STORAGE and
Timo Sirainen <tss@iki.fi>
parents:
5949
diff
changeset
|
38 /* Flush NFS caches for mail storage / index */ |
fe9da9c92cf4
Added MAIL_STORAGE_FLAG_NFS_FLUSH_STORAGE and
Timo Sirainen <tss@iki.fi>
parents:
5949
diff
changeset
|
39 MAIL_STORAGE_FLAG_NFS_FLUSH_STORAGE = 0x800, |
fe9da9c92cf4
Added MAIL_STORAGE_FLAG_NFS_FLUSH_STORAGE and
Timo Sirainen <tss@iki.fi>
parents:
5949
diff
changeset
|
40 MAIL_STORAGE_FLAG_NFS_FLUSH_INDEX = 0x1000, |
5975
78fe45cdc192
Added MAIL_STORAGE_FLAG_FSYNC_DISABLE and moved FSYNC_DISABLE environment
Timo Sirainen <tss@iki.fi>
parents:
5973
diff
changeset
|
41 /* Don't use fsync() or fdatasync() */ |
8427
47198d7a5f03
IGNORE_ACLS should have been mailbox_open_flags, not mail_storage_flag.
Timo Sirainen <tss@iki.fi>
parents:
8417
diff
changeset
|
42 MAIL_STORAGE_FLAG_FSYNC_DISABLE = 0x2000 |
3260
6a179bf1272e
Moved several getenv()s from lib-storage to main code. deliver binary was
Timo Sirainen <tss@iki.fi>
parents:
3254
diff
changeset
|
43 }; |
6a179bf1272e
Moved several getenv()s from lib-storage to main code. deliver binary was
Timo Sirainen <tss@iki.fi>
parents:
3254
diff
changeset
|
44 |
1622
d22e03714d36
index_mmap_invalidate = yes now invalidate memory maps before accessing
Timo Sirainen <tss@iki.fi>
parents:
1552
diff
changeset
|
45 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
|
46 /* 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
|
47 MAILBOX_OPEN_READONLY = 0x01, |
4041
9d7420b0e1ef
Make life easier for plugins:
Timo Sirainen <timo.sirainen@movial.fi>
parents:
3971
diff
changeset
|
48 /* Only saving/copying mails to mailbox works. */ |
9d7420b0e1ef
Make life easier for plugins:
Timo Sirainen <timo.sirainen@movial.fi>
parents:
3971
diff
changeset
|
49 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
|
50 /* 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
|
51 (eg. when opening mailbox just for STATUS). */ |
4041
9d7420b0e1ef
Make life easier for plugins:
Timo Sirainen <timo.sirainen@movial.fi>
parents:
3971
diff
changeset
|
52 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
|
53 /* 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
|
54 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
|
55 /* Don't create index files for the mailbox */ |
4152
e2edd333c473
Added MAILBOX_OPEN_KEEP_LOCKED flag to mailbox opening and implemented it
Timo Sirainen <tss@iki.fi>
parents:
4076
diff
changeset
|
56 MAILBOX_OPEN_NO_INDEX_FILES = 0x10, |
e2edd333c473
Added MAILBOX_OPEN_KEEP_LOCKED flag to mailbox opening and implemented it
Timo Sirainen <tss@iki.fi>
parents:
4076
diff
changeset
|
57 /* Keep mailbox exclusively locked all the time while it's open */ |
7620 | 58 MAILBOX_OPEN_KEEP_LOCKED = 0x20, |
8259
4dc07239ddfa
pop3+maildir: Make sure virtual sizes always get written to dovecot-uidlist file.
Timo Sirainen <tss@iki.fi>
parents:
8173
diff
changeset
|
59 /* Enable if mailbox is used for serving POP3. This allows making |
4dc07239ddfa
pop3+maildir: Make sure virtual sizes always get written to dovecot-uidlist file.
Timo Sirainen <tss@iki.fi>
parents:
8173
diff
changeset
|
60 better caching decisions. */ |
8427
47198d7a5f03
IGNORE_ACLS should have been mailbox_open_flags, not mail_storage_flag.
Timo Sirainen <tss@iki.fi>
parents:
8417
diff
changeset
|
61 MAILBOX_OPEN_POP3_SESSION = 0x40, |
8428
1b7c0a216663
ACLs: Initial support for "post" right.
Timo Sirainen <tss@iki.fi>
parents:
8427
diff
changeset
|
62 /* Enable if mailbox is used for saving a mail delivery using MDA. |
1b7c0a216663
ACLs: Initial support for "post" right.
Timo Sirainen <tss@iki.fi>
parents:
8427
diff
changeset
|
63 This causes ACL plugin to use POST right rather than INSERT. */ |
1b7c0a216663
ACLs: Initial support for "post" right.
Timo Sirainen <tss@iki.fi>
parents:
8427
diff
changeset
|
64 MAILBOX_OPEN_POST_SESSION = 0x80, |
8427
47198d7a5f03
IGNORE_ACLS should have been mailbox_open_flags, not mail_storage_flag.
Timo Sirainen <tss@iki.fi>
parents:
8417
diff
changeset
|
65 /* Force opening mailbox and ignoring any ACLs */ |
8428
1b7c0a216663
ACLs: Initial support for "post" right.
Timo Sirainen <tss@iki.fi>
parents:
8427
diff
changeset
|
66 MAILBOX_OPEN_IGNORE_ACLS = 0x100 |
7620 | 67 }; |
68 | |
69 enum mailbox_feature { | |
70 /* Enable tracking modsequences */ | |
71 MAILBOX_FEATURE_CONDSTORE = 0x01, | |
7629 | 72 /* Enable tracking expunge modsequences */ |
73 MAILBOX_FEATURE_QRESYNC = 0x02 | |
1622
d22e03714d36
index_mmap_invalidate = yes now invalidate memory maps before accessing
Timo Sirainen <tss@iki.fi>
parents:
1552
diff
changeset
|
74 }; |
d22e03714d36
index_mmap_invalidate = yes now invalidate memory maps before accessing
Timo Sirainen <tss@iki.fi>
parents:
1552
diff
changeset
|
75 |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
76 enum mailbox_status_items { |
0 | 77 STATUS_MESSAGES = 0x01, |
78 STATUS_RECENT = 0x02, | |
79 STATUS_UIDNEXT = 0x04, | |
80 STATUS_UIDVALIDITY = 0x08, | |
81 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
|
82 STATUS_FIRST_UNSEEN_SEQ = 0x20, |
7620 | 83 STATUS_KEYWORDS = 0x40, |
84 STATUS_HIGHESTMODSEQ = 0x80 | |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
85 }; |
0 | 86 |
7647
879208fdc7e3
Implemented CONTEXT=SEARCH extension.
Timo Sirainen <tss@iki.fi>
parents:
7642
diff
changeset
|
87 enum mailbox_search_result_flags { |
879208fdc7e3
Implemented CONTEXT=SEARCH extension.
Timo Sirainen <tss@iki.fi>
parents:
7642
diff
changeset
|
88 /* Update search results whenever the mailbox view is synced. |
879208fdc7e3
Implemented CONTEXT=SEARCH extension.
Timo Sirainen <tss@iki.fi>
parents:
7642
diff
changeset
|
89 Expunged messages are removed even without this flag. */ |
879208fdc7e3
Implemented CONTEXT=SEARCH extension.
Timo Sirainen <tss@iki.fi>
parents:
7642
diff
changeset
|
90 MAILBOX_SEARCH_RESULT_FLAG_UPDATE = 0x01, |
879208fdc7e3
Implemented CONTEXT=SEARCH extension.
Timo Sirainen <tss@iki.fi>
parents:
7642
diff
changeset
|
91 /* Queue changes so _sync() can be used. */ |
879208fdc7e3
Implemented CONTEXT=SEARCH extension.
Timo Sirainen <tss@iki.fi>
parents:
7642
diff
changeset
|
92 MAILBOX_SEARCH_RESULT_FLAG_QUEUE_SYNC = 0x02 |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
93 }; |
0 | 94 |
906
b176f913d092
"ISO C forbids forward references to enum types"
Timo Sirainen <tss@iki.fi>
parents:
903
diff
changeset
|
95 enum mail_sort_type { |
4303
5f03738219a6
Changed mail-storage API to do the mail sorting internally. Optimized it
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4274
diff
changeset
|
96 /* Maximum size for sort program (each one separately + END) */ |
8006
0a3b5ddb0869
Added support for sorting by X-SCORE. Currently it's only set by fts-solr.
Timo Sirainen <tss@iki.fi>
parents:
7930
diff
changeset
|
97 #define MAX_SORT_PROGRAM_SIZE (8 + 1) |
988
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
98 |
4303
5f03738219a6
Changed mail-storage API to do the mail sorting internally. Optimized it
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4274
diff
changeset
|
99 MAIL_SORT_ARRIVAL = 0x0001, |
5f03738219a6
Changed mail-storage API to do the mail sorting internally. Optimized it
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4274
diff
changeset
|
100 MAIL_SORT_CC = 0x0002, |
5f03738219a6
Changed mail-storage API to do the mail sorting internally. Optimized it
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4274
diff
changeset
|
101 MAIL_SORT_DATE = 0x0004, |
5f03738219a6
Changed mail-storage API to do the mail sorting internally. Optimized it
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4274
diff
changeset
|
102 MAIL_SORT_FROM = 0x0008, |
5f03738219a6
Changed mail-storage API to do the mail sorting internally. Optimized it
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4274
diff
changeset
|
103 MAIL_SORT_SIZE = 0x0010, |
5f03738219a6
Changed mail-storage API to do the mail sorting internally. Optimized it
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4274
diff
changeset
|
104 MAIL_SORT_SUBJECT = 0x0020, |
5f03738219a6
Changed mail-storage API to do the mail sorting internally. Optimized it
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4274
diff
changeset
|
105 MAIL_SORT_TO = 0x0040, |
8006
0a3b5ddb0869
Added support for sorting by X-SCORE. Currently it's only set by fts-solr.
Timo Sirainen <tss@iki.fi>
parents:
7930
diff
changeset
|
106 MAIL_SORT_SEARCH_SCORE = 0x0080, |
906
b176f913d092
"ISO C forbids forward references to enum types"
Timo Sirainen <tss@iki.fi>
parents:
903
diff
changeset
|
107 |
4303
5f03738219a6
Changed mail-storage API to do the mail sorting internally. Optimized it
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4274
diff
changeset
|
108 MAIL_SORT_MASK = 0x0fff, |
5f03738219a6
Changed mail-storage API to do the mail sorting internally. Optimized it
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4274
diff
changeset
|
109 MAIL_SORT_FLAG_REVERSE = 0x1000, /* reverse this mask type */ |
906
b176f913d092
"ISO C forbids forward references to enum types"
Timo Sirainen <tss@iki.fi>
parents:
903
diff
changeset
|
110 |
b176f913d092
"ISO C forbids forward references to enum types"
Timo Sirainen <tss@iki.fi>
parents:
903
diff
changeset
|
111 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
|
112 }; |
b176f913d092
"ISO C forbids forward references to enum types"
Timo Sirainen <tss@iki.fi>
parents:
903
diff
changeset
|
113 |
988
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
114 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
|
115 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
|
116 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
|
117 |
4455
fce5140fbe0b
Added mail_get_save_date() and some cleanups.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4451
diff
changeset
|
118 MAIL_FETCH_STREAM_HEADER = 0x00000004, |
fce5140fbe0b
Added mail_get_save_date() and some cleanups.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4451
diff
changeset
|
119 MAIL_FETCH_STREAM_BODY = 0x00000008, |
988
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
120 |
4455
fce5140fbe0b
Added mail_get_save_date() and some cleanups.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4451
diff
changeset
|
121 MAIL_FETCH_DATE = 0x00000010, |
fce5140fbe0b
Added mail_get_save_date() and some cleanups.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4451
diff
changeset
|
122 MAIL_FETCH_RECEIVED_DATE = 0x00000020, |
fce5140fbe0b
Added mail_get_save_date() and some cleanups.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4451
diff
changeset
|
123 MAIL_FETCH_SAVE_DATE = 0x00000040, |
fce5140fbe0b
Added mail_get_save_date() and some cleanups.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4451
diff
changeset
|
124 MAIL_FETCH_PHYSICAL_SIZE = 0x00000080, |
fce5140fbe0b
Added mail_get_save_date() and some cleanups.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4451
diff
changeset
|
125 MAIL_FETCH_VIRTUAL_SIZE = 0x00000100, |
988
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
126 |
5949
1a80f37a4a12
Added MAIL_FETCH_NUL_STATE. Don't try to fetch cached flags now unless it's
Timo Sirainen <tss@iki.fi>
parents:
5763
diff
changeset
|
127 /* Set has_nuls / has_no_nuls fields */ |
1a80f37a4a12
Added MAIL_FETCH_NUL_STATE. Don't try to fetch cached flags now unless it's
Timo Sirainen <tss@iki.fi>
parents:
5763
diff
changeset
|
128 MAIL_FETCH_NUL_STATE = 0x00000200, |
1a80f37a4a12
Added MAIL_FETCH_NUL_STATE. Don't try to fetch cached flags now unless it's
Timo Sirainen <tss@iki.fi>
parents:
5763
diff
changeset
|
129 |
988
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
130 /* specials: */ |
2238
9cc23c29aaec
Added a framework for getting POP3 UIDL strings from mail-storage. The
Timo Sirainen <tss@iki.fi>
parents:
2219
diff
changeset
|
131 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
|
132 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
|
133 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
|
134 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
|
135 MAIL_FETCH_HEADER_MD5 = 0x00010000, |
7570
2220b2aa9f7c
Maildir: If POP3 UIDL extra field is found from dovecot-uidlist, it's used
Timo Sirainen <tss@iki.fi>
parents:
7358
diff
changeset
|
136 MAIL_FETCH_UIDL_FILE_NAME = 0x00020000, |
7910
c1bbdc2b262e
FETCH X-MAILBOX and SEARCH X-MAILBOX can be used with virtual mailboxes to
Timo Sirainen <tss@iki.fi>
parents:
7907
diff
changeset
|
137 MAIL_FETCH_UIDL_BACKEND = 0x00040000, |
8006
0a3b5ddb0869
Added support for sorting by X-SCORE. Currently it's only set by fts-solr.
Timo Sirainen <tss@iki.fi>
parents:
7930
diff
changeset
|
138 MAIL_FETCH_MAILBOX_NAME = 0x00080000, |
8077
6d51328896d6
Added the concept of Global UIDs that are preserved across copies.
Timo Sirainen <tss@iki.fi>
parents:
8075
diff
changeset
|
139 MAIL_FETCH_SEARCH_SCORE = 0x00100000, |
6d51328896d6
Added the concept of Global UIDs that are preserved across copies.
Timo Sirainen <tss@iki.fi>
parents:
8075
diff
changeset
|
140 MAIL_FETCH_GUID = 0x00200000 |
988
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
141 }; |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
142 |
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
|
143 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
|
144 /* 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
|
145 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
|
146 /* 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
|
147 but nothing else. */ |
5572
896845fbc4ed
Added mailbox_transaction_commit_get_uids() which returns the UID range for
Timo Sirainen <tss@iki.fi>
parents:
5567
diff
changeset
|
148 MAILBOX_TRANSACTION_FLAG_EXTERNAL = 0x02, |
896845fbc4ed
Added mailbox_transaction_commit_get_uids() which returns the UID range for
Timo Sirainen <tss@iki.fi>
parents:
5567
diff
changeset
|
149 /* Always assign UIDs to messages when saving/copying. Normally this |
896845fbc4ed
Added mailbox_transaction_commit_get_uids() which returns the UID range for
Timo Sirainen <tss@iki.fi>
parents:
5567
diff
changeset
|
150 is done only if the mailbox is synced, or if dest_mail parameter |
896845fbc4ed
Added mailbox_transaction_commit_get_uids() which returns the UID range for
Timo Sirainen <tss@iki.fi>
parents:
5567
diff
changeset
|
151 was non-NULL to mailbox_save_init() or mailbox_copy() */ |
7631
5d3b6a766032
Added MAILBOX_TRANSACTION_FLAG_REFRESH. Use it with STORE UNCHANGEDSINCE.
Timo Sirainen <tss@iki.fi>
parents:
7629
diff
changeset
|
152 MAILBOX_TRANSACTION_FLAG_ASSIGN_UIDS = 0x04, |
5d3b6a766032
Added MAILBOX_TRANSACTION_FLAG_REFRESH. Use it with STORE UNCHANGEDSINCE.
Timo Sirainen <tss@iki.fi>
parents:
7629
diff
changeset
|
153 /* Refresh the index so lookups return latest flags/modseqs */ |
5d3b6a766032
Added MAILBOX_TRANSACTION_FLAG_REFRESH. Use it with STORE UNCHANGEDSINCE.
Timo Sirainen <tss@iki.fi>
parents:
7629
diff
changeset
|
154 MAILBOX_TRANSACTION_FLAG_REFRESH = 0x08 |
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
|
155 }; |
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
|
156 |
1730
8480f945e270
IDLE uses now IO_*_NOTIFY to get instant notifying of mails.
Timo Sirainen <tss@iki.fi>
parents:
1728
diff
changeset
|
157 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
|
158 /* Make sure we sync all external changes done to mailbox */ |
6674
2637fb191e5e
Added MAILBOX_SYNC_FLAG_FIX_INCONSISTENT flag. mailbox_sync() uses it
Timo Sirainen <tss@iki.fi>
parents:
6512
diff
changeset
|
159 MAILBOX_SYNC_FLAG_FULL_READ = 0x01, |
2665
ccf563859be5
Split sync_flag_full into sync_flag_full_read and _write. Closing mailbox
Timo Sirainen <tss@iki.fi>
parents:
2589
diff
changeset
|
160 /* Make sure we write all our internal changes into the mailbox */ |
6674
2637fb191e5e
Added MAILBOX_SYNC_FLAG_FIX_INCONSISTENT flag. mailbox_sync() uses it
Timo Sirainen <tss@iki.fi>
parents:
6512
diff
changeset
|
161 MAILBOX_SYNC_FLAG_FULL_WRITE = 0x02, |
2665
ccf563859be5
Split sync_flag_full into sync_flag_full_read and _write. Closing mailbox
Timo Sirainen <tss@iki.fi>
parents:
2589
diff
changeset
|
162 /* If it's not too much trouble, check if there are some changes */ |
6674
2637fb191e5e
Added MAILBOX_SYNC_FLAG_FIX_INCONSISTENT flag. mailbox_sync() uses it
Timo Sirainen <tss@iki.fi>
parents:
6512
diff
changeset
|
163 MAILBOX_SYNC_FLAG_FAST = 0x04, |
2665
ccf563859be5
Split sync_flag_full into sync_flag_full_read and _write. Closing mailbox
Timo Sirainen <tss@iki.fi>
parents:
2589
diff
changeset
|
164 |
ccf563859be5
Split sync_flag_full into sync_flag_full_read and _write. Closing mailbox
Timo Sirainen <tss@iki.fi>
parents:
2589
diff
changeset
|
165 /* Don't sync expunges from our view */ |
6674
2637fb191e5e
Added MAILBOX_SYNC_FLAG_FIX_INCONSISTENT flag. mailbox_sync() uses it
Timo Sirainen <tss@iki.fi>
parents:
6512
diff
changeset
|
166 MAILBOX_SYNC_FLAG_NO_EXPUNGES = 0x08, |
2665
ccf563859be5
Split sync_flag_full into sync_flag_full_read and _write. Closing mailbox
Timo Sirainen <tss@iki.fi>
parents:
2589
diff
changeset
|
167 /* Stop auto syncing */ |
6674
2637fb191e5e
Added MAILBOX_SYNC_FLAG_FIX_INCONSISTENT flag. mailbox_sync() uses it
Timo Sirainen <tss@iki.fi>
parents:
6512
diff
changeset
|
168 MAILBOX_SYNC_AUTO_STOP = 0x20, |
2637fb191e5e
Added MAILBOX_SYNC_FLAG_FIX_INCONSISTENT flag. mailbox_sync() uses it
Timo Sirainen <tss@iki.fi>
parents:
6512
diff
changeset
|
169 /* If mailbox is currently inconsistent, fix it instead of failing. */ |
7661
d274d0870a1a
Added MAILBOX_SYNC_FLAG_EXPUNGE.
Timo Sirainen <tss@iki.fi>
parents:
7358
diff
changeset
|
170 MAILBOX_SYNC_FLAG_FIX_INCONSISTENT = 0x40, |
d274d0870a1a
Added MAILBOX_SYNC_FLAG_EXPUNGE.
Timo Sirainen <tss@iki.fi>
parents:
7358
diff
changeset
|
171 /* Syncing after an EXPUNGE command. This is just an informational |
d274d0870a1a
Added MAILBOX_SYNC_FLAG_EXPUNGE.
Timo Sirainen <tss@iki.fi>
parents:
7358
diff
changeset
|
172 flag for plugins. */ |
d274d0870a1a
Added MAILBOX_SYNC_FLAG_EXPUNGE.
Timo Sirainen <tss@iki.fi>
parents:
7358
diff
changeset
|
173 MAILBOX_SYNC_FLAG_EXPUNGE = 0x80 |
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
|
174 }; |
bc3307f2f35d
Only NOOP and CHECK will now always do a real mailbox sync. Other commands
Timo Sirainen <tss@iki.fi>
parents:
1534
diff
changeset
|
175 |
2322
aae574ed7f4c
Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents:
2316
diff
changeset
|
176 enum mailbox_sync_type { |
aae574ed7f4c
Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents:
2316
diff
changeset
|
177 MAILBOX_SYNC_TYPE_EXPUNGE = 0x01, |
7620 | 178 MAILBOX_SYNC_TYPE_FLAGS = 0x02, |
179 MAILBOX_SYNC_TYPE_MODSEQ = 0x04 | |
2322
aae574ed7f4c
Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents:
2316
diff
changeset
|
180 }; |
aae574ed7f4c
Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents:
2316
diff
changeset
|
181 |
6280
eb7c9d8ece54
mail_*() APIs changed to return int and return the actual data as pointer.
Timo Sirainen <tss@iki.fi>
parents:
6279
diff
changeset
|
182 struct message_part; |
5500
4862cb37106c
Moved namespace handling to lib-storage. Beginnings of namespace support for
Timo Sirainen <tss@iki.fi>
parents:
5461
diff
changeset
|
183 struct mail_namespace; |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
184 struct mail_storage; |
7642
077bb84e9e77
Make mail_search_args an independent structure that can be used for multiple
Timo Sirainen <tss@iki.fi>
parents:
7631
diff
changeset
|
185 struct mail_search_args; |
7647
879208fdc7e3
Implemented CONTEXT=SEARCH extension.
Timo Sirainen <tss@iki.fi>
parents:
7642
diff
changeset
|
186 struct mail_search_result; |
3016
61c8d205d887
Initial support for keywords. Syncing to mbox/maildir doesn't work yet.
Timo Sirainen <tss@iki.fi>
parents:
2996
diff
changeset
|
187 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
|
188 struct mail_save_context; |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
1845
diff
changeset
|
189 struct mailbox; |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
1845
diff
changeset
|
190 struct mailbox_transaction_context; |
0 | 191 |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
1845
diff
changeset
|
192 struct mailbox_status { |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
1845
diff
changeset
|
193 uint32_t messages; |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
1845
diff
changeset
|
194 uint32_t recent; |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
1845
diff
changeset
|
195 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
|
196 |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
1845
diff
changeset
|
197 uint32_t uidvalidity; |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
1845
diff
changeset
|
198 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
|
199 |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
1845
diff
changeset
|
200 uint32_t first_unseen_seq; |
7620 | 201 uint64_t highest_modseq; |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
1845
diff
changeset
|
202 |
4451
1a35d53c18fc
Array API redesigned to work using unions. It now provides type safety
Timo Sirainen <tss@iki.fi>
parents:
4303
diff
changeset
|
203 const ARRAY_TYPE(keywords) *keywords; |
7815
2d62129a709b
QRESYNC: If MODSEQs were returned in FETCH replies but there are pending
Timo Sirainen <tss@iki.fi>
parents:
7798
diff
changeset
|
204 |
2d62129a709b
QRESYNC: If MODSEQs were returned in FETCH replies but there are pending
Timo Sirainen <tss@iki.fi>
parents:
7798
diff
changeset
|
205 /* There are expunges that haven't been synced yet */ |
2d62129a709b
QRESYNC: If MODSEQs were returned in FETCH replies but there are pending
Timo Sirainen <tss@iki.fi>
parents:
7798
diff
changeset
|
206 unsigned int sync_delayed_expunges:1; |
7930
b4286cde68d0
CONDSTORE: Return HIGHESTMODSEQ correctly even if indexes are in memory.
Timo Sirainen <tss@iki.fi>
parents:
7913
diff
changeset
|
207 /* Modseqs aren't permanent (index is in memory) */ |
b4286cde68d0
CONDSTORE: Return HIGHESTMODSEQ correctly even if indexes are in memory.
Timo Sirainen <tss@iki.fi>
parents:
7913
diff
changeset
|
208 unsigned int nonpermanent_modseqs:1; |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
1845
diff
changeset
|
209 }; |
450
925d6eb5f8be
MailStorage interface change. We now let storage call several sync-functions
Timo Sirainen <tss@iki.fi>
parents:
410
diff
changeset
|
210 |
2322
aae574ed7f4c
Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents:
2316
diff
changeset
|
211 struct mailbox_sync_rec { |
aae574ed7f4c
Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents:
2316
diff
changeset
|
212 uint32_t seq1, seq2; |
aae574ed7f4c
Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents:
2316
diff
changeset
|
213 enum mailbox_sync_type type; |
aae574ed7f4c
Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents:
2316
diff
changeset
|
214 }; |
aae574ed7f4c
Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents:
2316
diff
changeset
|
215 |
8981
5611bba3548b
Added struct mail.lookup_abort, which can be used to abort lookups that can't be done using cache.
Timo Sirainen <tss@iki.fi>
parents:
8786
diff
changeset
|
216 enum mail_lookup_abort { |
5611bba3548b
Added struct mail.lookup_abort, which can be used to abort lookups that can't be done using cache.
Timo Sirainen <tss@iki.fi>
parents:
8786
diff
changeset
|
217 /* Perform everything no matter what it takes */ |
5611bba3548b
Added struct mail.lookup_abort, which can be used to abort lookups that can't be done using cache.
Timo Sirainen <tss@iki.fi>
parents:
8786
diff
changeset
|
218 MAIL_LOOKUP_ABORT_NEVER = 0, |
5611bba3548b
Added struct mail.lookup_abort, which can be used to abort lookups that can't be done using cache.
Timo Sirainen <tss@iki.fi>
parents:
8786
diff
changeset
|
219 /* Abort if the operation would require reading message header/body */ |
5611bba3548b
Added struct mail.lookup_abort, which can be used to abort lookups that can't be done using cache.
Timo Sirainen <tss@iki.fi>
parents:
8786
diff
changeset
|
220 MAIL_LOOKUP_ABORT_READ_MAIL, |
5611bba3548b
Added struct mail.lookup_abort, which can be used to abort lookups that can't be done using cache.
Timo Sirainen <tss@iki.fi>
parents:
8786
diff
changeset
|
221 /* Abort if the operation can't be done fully using cache file */ |
5611bba3548b
Added struct mail.lookup_abort, which can be used to abort lookups that can't be done using cache.
Timo Sirainen <tss@iki.fi>
parents:
8786
diff
changeset
|
222 MAIL_LOOKUP_ABORT_NOT_IN_CACHE |
5611bba3548b
Added struct mail.lookup_abort, which can be used to abort lookups that can't be done using cache.
Timo Sirainen <tss@iki.fi>
parents:
8786
diff
changeset
|
223 }; |
5611bba3548b
Added struct mail.lookup_abort, which can be used to abort lookups that can't be done using cache.
Timo Sirainen <tss@iki.fi>
parents:
8786
diff
changeset
|
224 |
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
|
225 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
|
226 /* 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
|
227 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
|
228 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
|
229 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
|
230 |
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
|
231 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
|
232 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
|
233 unsigned int has_no_nuls:1; /* -''- known to not contain NULs */ |
8981
5611bba3548b
Added struct mail.lookup_abort, which can be used to abort lookups that can't be done using cache.
Timo Sirainen <tss@iki.fi>
parents:
8786
diff
changeset
|
234 |
5611bba3548b
Added struct mail.lookup_abort, which can be used to abort lookups that can't be done using cache.
Timo Sirainen <tss@iki.fi>
parents:
8786
diff
changeset
|
235 enum mail_lookup_abort lookup_abort; |
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
|
236 }; |
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
|
237 |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
1845
diff
changeset
|
238 struct mail_storage_callbacks { |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
1845
diff
changeset
|
239 /* "* OK <text>" */ |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
1845
diff
changeset
|
240 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
|
241 void *context); |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
1845
diff
changeset
|
242 /* "* NO <text>" */ |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
1845
diff
changeset
|
243 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
|
244 void *context); |
0 | 245 |
2322
aae574ed7f4c
Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents:
2316
diff
changeset
|
246 }; |
0 | 247 |
8499
252b29ac5f43
fts: Added support for handling multiple namespaces.
Timo Sirainen <tss@iki.fi>
parents:
8495
diff
changeset
|
248 struct mailbox_virtual_pattern { |
252b29ac5f43
fts: Added support for handling multiple namespaces.
Timo Sirainen <tss@iki.fi>
parents:
8495
diff
changeset
|
249 struct mail_namespace *ns; |
252b29ac5f43
fts: Added support for handling multiple namespaces.
Timo Sirainen <tss@iki.fi>
parents:
8495
diff
changeset
|
250 const char *pattern; |
252b29ac5f43
fts: Added support for handling multiple namespaces.
Timo Sirainen <tss@iki.fi>
parents:
8495
diff
changeset
|
251 }; |
252b29ac5f43
fts: Added support for handling multiple namespaces.
Timo Sirainen <tss@iki.fi>
parents:
8495
diff
changeset
|
252 ARRAY_DEFINE_TYPE(mailbox_virtual_patterns, struct mailbox_virtual_pattern); |
252b29ac5f43
fts: Added support for handling multiple namespaces.
Timo Sirainen <tss@iki.fi>
parents:
8495
diff
changeset
|
253 |
8495
ffb37c392166
Finished making full text search indexes work fast with virtual mailboxes.
Timo Sirainen <tss@iki.fi>
parents:
8484
diff
changeset
|
254 ARRAY_DEFINE_TYPE(mailboxes, struct mailbox *); |
ffb37c392166
Finished making full text search indexes work fast with virtual mailboxes.
Timo Sirainen <tss@iki.fi>
parents:
8484
diff
changeset
|
255 |
2322
aae574ed7f4c
Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents:
2316
diff
changeset
|
256 typedef void mailbox_notify_callback_t(struct mailbox *box, void *context); |
0 | 257 |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
1845
diff
changeset
|
258 void mail_storage_init(void); |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
1845
diff
changeset
|
259 void mail_storage_deinit(void); |
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 /* register all mail storages */ |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
1845
diff
changeset
|
262 void mail_storage_register_all(void); |
0 | 263 |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
1845
diff
changeset
|
264 /* 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
|
265 are set to default methods */ |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
1845
diff
changeset
|
266 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
|
267 void mail_storage_class_unregister(struct mail_storage *storage_class); |
8173
6dd0c6755afe
Added initial support for shared mailboxes. Listing isn't supported yet.
Timo Sirainen <tss@iki.fi>
parents:
8083
diff
changeset
|
268 /* Find mail storage class by name */ |
6dd0c6755afe
Added initial support for shared mailboxes. Listing isn't supported yet.
Timo Sirainen <tss@iki.fi>
parents:
8083
diff
changeset
|
269 struct mail_storage *mail_storage_find_class(const char *name); |
1642
72c6e848f583
API changes: Don't keep variables in mailbox class.
Timo Sirainen <tss@iki.fi>
parents:
1640
diff
changeset
|
270 |
3971
539a58176e7b
Moved mailbox flag and lock method parsing to lib-storage.
Timo Sirainen <tss@iki.fi>
parents:
3879
diff
changeset
|
271 /* 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
|
272 void mail_storage_parse_env(enum mail_storage_flags *flags_r, |
4876
f1d77064884c
Lock handling changes. Everything goes through file-lock API now and there's
Timo Sirainen <tss@iki.fi>
parents:
4859
diff
changeset
|
273 enum file_lock_method *lock_method_r); |
3971
539a58176e7b
Moved mailbox flag and lock method parsing to lib-storage.
Timo Sirainen <tss@iki.fi>
parents:
3879
diff
changeset
|
274 |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
1845
diff
changeset
|
275 /* Create a new instance of registered mail storage class with given |
5461
08b42ced91a6
Removed mail_storage_create_with_data(). mail_storage_create() with
Timo Sirainen <tss@iki.fi>
parents:
5448
diff
changeset
|
276 storage-specific data. If driver is NULL, it's tried to be autodetected |
08b42ced91a6
Removed mail_storage_create_with_data(). mail_storage_create() with
Timo Sirainen <tss@iki.fi>
parents:
5448
diff
changeset
|
277 from data. If data is NULL, it uses the first storage that exists. |
5500
4862cb37106c
Moved namespace handling to lib-storage. Beginnings of namespace support for
Timo Sirainen <tss@iki.fi>
parents:
5461
diff
changeset
|
278 The storage is put into ns->storage. */ |
4862cb37106c
Moved namespace handling to lib-storage. Beginnings of namespace support for
Timo Sirainen <tss@iki.fi>
parents:
5461
diff
changeset
|
279 int mail_storage_create(struct mail_namespace *ns, const char *driver, |
8082
db66611fd195
Added struct mail_user and fixed the code to support multiple users per process.
Timo Sirainen <tss@iki.fi>
parents:
8077
diff
changeset
|
280 const char *data, enum mail_storage_flags flags, |
6023
56879cc53cec
mail_storage.create() now returns error message string. Also fixed handling
Timo Sirainen <tss@iki.fi>
parents:
5975
diff
changeset
|
281 enum file_lock_method lock_method, |
56879cc53cec
mail_storage.create() now returns error message string. Also fixed handling
Timo Sirainen <tss@iki.fi>
parents:
5975
diff
changeset
|
282 const char **error_r); |
4808
93bc9770f938
Initial code for separation of mailbox accessing and directory layout
Timo Sirainen <tss@iki.fi>
parents:
4646
diff
changeset
|
283 void mail_storage_destroy(struct mail_storage **storage); |
1639
3621292209f4
Explicit lock() method for mailbox.
Timo Sirainen <tss@iki.fi>
parents:
1638
diff
changeset
|
284 |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
1845
diff
changeset
|
285 char mail_storage_get_hierarchy_sep(struct mail_storage *storage); |
7912
81806d402514
Added more consts, ATTR_CONSTs and ATTR_PUREs.
Timo Sirainen <tss@iki.fi>
parents:
7910
diff
changeset
|
286 struct mailbox_list * |
81806d402514
Added more consts, ATTR_CONSTs and ATTR_PUREs.
Timo Sirainen <tss@iki.fi>
parents:
7910
diff
changeset
|
287 mail_storage_get_list(const struct mail_storage *storage) ATTR_PURE; |
81806d402514
Added more consts, ATTR_CONSTs and ATTR_PUREs.
Timo Sirainen <tss@iki.fi>
parents:
7910
diff
changeset
|
288 struct mail_namespace * |
81806d402514
Added more consts, ATTR_CONSTs and ATTR_PUREs.
Timo Sirainen <tss@iki.fi>
parents:
7910
diff
changeset
|
289 mail_storage_get_namespace(const struct mail_storage *storage) ATTR_PURE; |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
1845
diff
changeset
|
290 |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
1845
diff
changeset
|
291 /* Set storage callback functions to use. */ |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
1845
diff
changeset
|
292 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
|
293 struct mail_storage_callbacks *callbacks, |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
1845
diff
changeset
|
294 void *context); |
0 | 295 |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
1845
diff
changeset
|
296 /* 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
|
297 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
|
298 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
|
299 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
|
300 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
|
301 bool directory); |
1172 | 302 |
3520 | 303 /* 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
|
304 const char *mail_storage_get_last_error(struct mail_storage *storage, |
5613 | 305 enum mail_error *error_r); |
988
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
306 |
4041
9d7420b0e1ef
Make life easier for plugins:
Timo Sirainen <timo.sirainen@movial.fi>
parents:
3971
diff
changeset
|
307 /* 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
|
308 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
|
309 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
|
310 directory is returned. */ |
9d7420b0e1ef
Make life easier for plugins:
Timo Sirainen <timo.sirainen@movial.fi>
parents:
3971
diff
changeset
|
311 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
|
312 const char *name, bool *is_file_r); |
9d7420b0e1ef
Make life easier for plugins:
Timo Sirainen <timo.sirainen@movial.fi>
parents:
3971
diff
changeset
|
313 /* 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
|
314 doesn't exist in filesystem. */ |
9d7420b0e1ef
Make life easier for plugins:
Timo Sirainen <timo.sirainen@movial.fi>
parents:
3971
diff
changeset
|
315 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
|
316 const char *name); |
4606
baaf62ced3d0
Added mail_storage_get_mailbox_index_dir().
Timo Sirainen <tss@iki.fi>
parents:
4548
diff
changeset
|
317 /* Returns path to the index directory of the mailbox, or NULL if using |
baaf62ced3d0
Added mail_storage_get_mailbox_index_dir().
Timo Sirainen <tss@iki.fi>
parents:
4548
diff
changeset
|
318 in-memory indexes or mailbox doesn't exist. */ |
baaf62ced3d0
Added mail_storage_get_mailbox_index_dir().
Timo Sirainen <tss@iki.fi>
parents:
4548
diff
changeset
|
319 const char *mail_storage_get_mailbox_index_dir(struct mail_storage *storage, |
baaf62ced3d0
Added mail_storage_get_mailbox_index_dir().
Timo Sirainen <tss@iki.fi>
parents:
4548
diff
changeset
|
320 const char *name); |
8786
db9811ec1f47
Added mail_user_get_temp_prefix() and mail_storage_get_temp_prefix().
Timo Sirainen <tss@iki.fi>
parents:
8726
diff
changeset
|
321 /* Returns path + file prefix for creating a temporary file. */ |
db9811ec1f47
Added mail_user_get_temp_prefix() and mail_storage_get_temp_prefix().
Timo Sirainen <tss@iki.fi>
parents:
8726
diff
changeset
|
322 const char *mail_storage_get_temp_prefix(struct mail_storage *storage); |
4041
9d7420b0e1ef
Make life easier for plugins:
Timo Sirainen <timo.sirainen@movial.fi>
parents:
3971
diff
changeset
|
323 |
3245
6491dab63e54
Added input stream parameter to mailbox_open(). With mbox it now allows
Timo Sirainen <tss@iki.fi>
parents:
3209
diff
changeset
|
324 /* 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
|
325 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
|
326 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
|
327 |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
1845
diff
changeset
|
328 Note that append and copy may open the selected mailbox again |
8468
d4eab639c253
mailbox_open() now takes struct mail_storage ** so it can be changed.
Timo Sirainen <tss@iki.fi>
parents:
8453
diff
changeset
|
329 with possibly different readonly-state. |
d4eab639c253
mailbox_open() now takes struct mail_storage ** so it can be changed.
Timo Sirainen <tss@iki.fi>
parents:
8453
diff
changeset
|
330 |
d4eab639c253
mailbox_open() now takes struct mail_storage ** so it can be changed.
Timo Sirainen <tss@iki.fi>
parents:
8453
diff
changeset
|
331 Given storage is a pointer-to-pointer because it may change as a result of |
d4eab639c253
mailbox_open() now takes struct mail_storage ** so it can be changed.
Timo Sirainen <tss@iki.fi>
parents:
8453
diff
changeset
|
332 a new namespace being created for shared mailboxes. */ |
d4eab639c253
mailbox_open() now takes struct mail_storage ** so it can be changed.
Timo Sirainen <tss@iki.fi>
parents:
8453
diff
changeset
|
333 struct mailbox *mailbox_open(struct mail_storage **storage, const char *name, |
3245
6491dab63e54
Added input stream parameter to mailbox_open(). With mbox it now allows
Timo Sirainen <tss@iki.fi>
parents:
3209
diff
changeset
|
334 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
|
335 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
|
336 /* 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
|
337 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
|
338 int mailbox_close(struct mailbox **box); |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
1845
diff
changeset
|
339 |
7620 | 340 /* Enable the given feature for the mailbox. */ |
341 int mailbox_enable(struct mailbox *box, enum mailbox_feature features); | |
342 enum mailbox_feature mailbox_get_enabled_features(struct mailbox *box); | |
343 | |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
1845
diff
changeset
|
344 /* Returns storage of given mailbox */ |
7912
81806d402514
Added more consts, ATTR_CONSTs and ATTR_PUREs.
Timo Sirainen <tss@iki.fi>
parents:
7910
diff
changeset
|
345 struct mail_storage *mailbox_get_storage(const struct mailbox *box) ATTR_PURE; |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
1845
diff
changeset
|
346 |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
1845
diff
changeset
|
347 /* Returns name of given mailbox */ |
7912
81806d402514
Added more consts, ATTR_CONSTs and ATTR_PUREs.
Timo Sirainen <tss@iki.fi>
parents:
7910
diff
changeset
|
348 const char *mailbox_get_name(const struct mailbox *box) ATTR_PURE; |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
1845
diff
changeset
|
349 |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
1845
diff
changeset
|
350 /* 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
|
351 bool mailbox_is_readonly(struct mailbox *box); |
1958 | 352 /* 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
|
353 bool mailbox_allow_new_keywords(struct mailbox *box); |
9237
72f159e0aaa6
Added mailbox_backends_equal().
Timo Sirainen <tss@iki.fi>
parents:
8981
diff
changeset
|
354 /* Returns TRUE if two mailboxes point to the same physical mailbox. */ |
72f159e0aaa6
Added mailbox_backends_equal().
Timo Sirainen <tss@iki.fi>
parents:
8981
diff
changeset
|
355 bool mailbox_backends_equal(const struct mailbox *box1, |
72f159e0aaa6
Added mailbox_backends_equal().
Timo Sirainen <tss@iki.fi>
parents:
8981
diff
changeset
|
356 const struct mailbox *box2); |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
1845
diff
changeset
|
357 |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
1845
diff
changeset
|
358 /* Gets the mailbox status information. */ |
6275
913b188f4dd4
Removed explicit locking from views and maps. They were already locked all
Timo Sirainen <tss@iki.fi>
parents:
6267
diff
changeset
|
359 void mailbox_get_status(struct mailbox *box, enum mailbox_status_items items, |
913b188f4dd4
Removed explicit locking from views and maps. They were already locked all
Timo Sirainen <tss@iki.fi>
parents:
6267
diff
changeset
|
360 struct mailbox_status *status_r); |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
1845
diff
changeset
|
361 |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
1845
diff
changeset
|
362 /* Synchronize the mailbox. */ |
2322
aae574ed7f4c
Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents:
2316
diff
changeset
|
363 struct mailbox_sync_context * |
aae574ed7f4c
Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents:
2316
diff
changeset
|
364 mailbox_sync_init(struct mailbox *box, enum mailbox_sync_flags flags); |
6279
f52e7d1402b5
mail_index_view_sync_next() and mailbox_sync_next() returns now bool.
Timo Sirainen <tss@iki.fi>
parents:
6277
diff
changeset
|
365 bool mailbox_sync_next(struct mailbox_sync_context *ctx, |
f52e7d1402b5
mail_index_view_sync_next() and mailbox_sync_next() returns now bool.
Timo Sirainen <tss@iki.fi>
parents:
6277
diff
changeset
|
366 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
|
367 int mailbox_sync_deinit(struct mailbox_sync_context **ctx, |
4848
967de900c73a
Mailbox list indexing and related changes. Currently works only with
Timo Sirainen <tss@iki.fi>
parents:
4808
diff
changeset
|
368 enum mailbox_status_items status_items, |
2322
aae574ed7f4c
Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents:
2316
diff
changeset
|
369 struct mailbox_status *status_r); |
6462
60a34f26c35a
Added mailbox_sync() to easily synchronize a mailbox.
Timo Sirainen <tss@iki.fi>
parents:
6410
diff
changeset
|
370 /* One-step mailbox synchronization. Use this if you don't care about |
60a34f26c35a
Added mailbox_sync() to easily synchronize a mailbox.
Timo Sirainen <tss@iki.fi>
parents:
6410
diff
changeset
|
371 changes. */ |
60a34f26c35a
Added mailbox_sync() to easily synchronize a mailbox.
Timo Sirainen <tss@iki.fi>
parents:
6410
diff
changeset
|
372 int mailbox_sync(struct mailbox *box, enum mailbox_sync_flags flags, |
60a34f26c35a
Added mailbox_sync() to easily synchronize a mailbox.
Timo Sirainen <tss@iki.fi>
parents:
6410
diff
changeset
|
373 enum mailbox_status_items status_items, |
60a34f26c35a
Added mailbox_sync() to easily synchronize a mailbox.
Timo Sirainen <tss@iki.fi>
parents:
6410
diff
changeset
|
374 struct mailbox_status *status_r); |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
1845
diff
changeset
|
375 |
4907
5b4c9b20eba0
Replaced void *context from a lot of callbacks with the actual context
Timo Sirainen <tss@iki.fi>
parents:
4876
diff
changeset
|
376 /* Call given callback function when something changes in the mailbox. */ |
2322
aae574ed7f4c
Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents:
2316
diff
changeset
|
377 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
|
378 mailbox_notify_callback_t *callback, void *context); |
4907
5b4c9b20eba0
Replaced void *context from a lot of callbacks with the actual context
Timo Sirainen <tss@iki.fi>
parents:
4876
diff
changeset
|
379 #ifdef CONTEXT_TYPE_SAFETY |
5b4c9b20eba0
Replaced void *context from a lot of callbacks with the actual context
Timo Sirainen <tss@iki.fi>
parents:
4876
diff
changeset
|
380 # define mailbox_notify_changes(box, min_interval, callback, context) \ |
5b4c9b20eba0
Replaced void *context from a lot of callbacks with the actual context
Timo Sirainen <tss@iki.fi>
parents:
4876
diff
changeset
|
381 ({(void)(1 ? 0 : callback((struct mailbox *)NULL, context)); \ |
5b4c9b20eba0
Replaced void *context from a lot of callbacks with the actual context
Timo Sirainen <tss@iki.fi>
parents:
4876
diff
changeset
|
382 mailbox_notify_changes(box, min_interval, \ |
5b4c9b20eba0
Replaced void *context from a lot of callbacks with the actual context
Timo Sirainen <tss@iki.fi>
parents:
4876
diff
changeset
|
383 (mailbox_notify_callback_t *)callback, context); }) |
5b4c9b20eba0
Replaced void *context from a lot of callbacks with the actual context
Timo Sirainen <tss@iki.fi>
parents:
4876
diff
changeset
|
384 #else |
5b4c9b20eba0
Replaced void *context from a lot of callbacks with the actual context
Timo Sirainen <tss@iki.fi>
parents:
4876
diff
changeset
|
385 # define mailbox_notify_changes(box, min_interval, callback, context) \ |
5b4c9b20eba0
Replaced void *context from a lot of callbacks with the actual context
Timo Sirainen <tss@iki.fi>
parents:
4876
diff
changeset
|
386 mailbox_notify_changes(box, min_interval, \ |
5b4c9b20eba0
Replaced void *context from a lot of callbacks with the actual context
Timo Sirainen <tss@iki.fi>
parents:
4876
diff
changeset
|
387 (mailbox_notify_callback_t *)callback, context) |
5b4c9b20eba0
Replaced void *context from a lot of callbacks with the actual context
Timo Sirainen <tss@iki.fi>
parents:
4876
diff
changeset
|
388 #endif |
5b4c9b20eba0
Replaced void *context from a lot of callbacks with the actual context
Timo Sirainen <tss@iki.fi>
parents:
4876
diff
changeset
|
389 void mailbox_notify_changes_stop(struct mailbox *box); |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
1845
diff
changeset
|
390 |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
1845
diff
changeset
|
391 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
|
392 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
|
393 enum mailbox_transaction_flags flags); |
6512
1a3604c8ee05
mailbox_transaction_commit*() doesn't sync the mailbox anymore, so it
Timo Sirainen <tss@iki.fi>
parents:
6503
diff
changeset
|
394 int mailbox_transaction_commit(struct mailbox_transaction_context **t); |
5572
896845fbc4ed
Added mailbox_transaction_commit_get_uids() which returns the UID range for
Timo Sirainen <tss@iki.fi>
parents:
5567
diff
changeset
|
395 /* If no messages were saved/copied, first/last_saved_uid_r are 0. */ |
896845fbc4ed
Added mailbox_transaction_commit_get_uids() which returns the UID range for
Timo Sirainen <tss@iki.fi>
parents:
5567
diff
changeset
|
396 int mailbox_transaction_commit_get_uids(struct mailbox_transaction_context **t, |
6267
3a1eed408cad
mailbox_transaction_commit_get_uids() now returns also UIDVALIDITY. It's the
Timo Sirainen <tss@iki.fi>
parents:
6120
diff
changeset
|
397 uint32_t *uid_validity_r, |
5572
896845fbc4ed
Added mailbox_transaction_commit_get_uids() which returns the UID range for
Timo Sirainen <tss@iki.fi>
parents:
5567
diff
changeset
|
398 uint32_t *first_saved_uid_r, |
896845fbc4ed
Added mailbox_transaction_commit_get_uids() which returns the UID range for
Timo Sirainen <tss@iki.fi>
parents:
5567
diff
changeset
|
399 uint32_t *last_saved_uid_r); |
3879
928229f8b3e6
deinit, unref, destroy, close, free, etc. functions now take a pointer to
Timo Sirainen <tss@iki.fi>
parents:
3863
diff
changeset
|
400 void mailbox_transaction_rollback(struct mailbox_transaction_context **t); |
4939
ff2272c228cc
Dovecot is now able to execute multiple commands at the same time.
Timo Sirainen <tss@iki.fi>
parents:
4907
diff
changeset
|
401 /* Return the number of active transactions for the mailbox. */ |
7912
81806d402514
Added more consts, ATTR_CONSTs and ATTR_PUREs.
Timo Sirainen <tss@iki.fi>
parents:
7910
diff
changeset
|
402 unsigned int mailbox_transaction_get_count(const struct mailbox *box) ATTR_PURE; |
7913
e04513064165
CONDSTORE: STORE UNCHANGEDSINCE conflicts are now checked atomically.
Timo Sirainen <tss@iki.fi>
parents:
7912
diff
changeset
|
403 /* When committing transaction, drop flag/keyword updates for messages whose |
8083 | 404 modseq is larger than max_modseq. Save those messages' sequences to the |
7913
e04513064165
CONDSTORE: STORE UNCHANGEDSINCE conflicts are now checked atomically.
Timo Sirainen <tss@iki.fi>
parents:
7912
diff
changeset
|
405 given array. */ |
e04513064165
CONDSTORE: STORE UNCHANGEDSINCE conflicts are now checked atomically.
Timo Sirainen <tss@iki.fi>
parents:
7912
diff
changeset
|
406 void mailbox_transaction_set_max_modseq(struct mailbox_transaction_context *t, |
e04513064165
CONDSTORE: STORE UNCHANGEDSINCE conflicts are now checked atomically.
Timo Sirainen <tss@iki.fi>
parents:
7912
diff
changeset
|
407 uint64_t max_modseq, |
e04513064165
CONDSTORE: STORE UNCHANGEDSINCE conflicts are now checked atomically.
Timo Sirainen <tss@iki.fi>
parents:
7912
diff
changeset
|
408 ARRAY_TYPE(seq_range) *seqs); |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
1845
diff
changeset
|
409 |
7358
ffb7e8b1c114
Added mailbox_transaction_get_mailbox()
Timo Sirainen <tss@iki.fi>
parents:
7241
diff
changeset
|
410 struct mailbox * |
7912
81806d402514
Added more consts, ATTR_CONSTs and ATTR_PUREs.
Timo Sirainen <tss@iki.fi>
parents:
7910
diff
changeset
|
411 mailbox_transaction_get_mailbox(const struct mailbox_transaction_context *t) |
81806d402514
Added more consts, ATTR_CONSTs and ATTR_PUREs.
Timo Sirainen <tss@iki.fi>
parents:
7910
diff
changeset
|
412 ATTR_PURE; |
7358
ffb7e8b1c114
Added mailbox_transaction_get_mailbox()
Timo Sirainen <tss@iki.fi>
parents:
7241
diff
changeset
|
413 |
6353
23c9ac999578
mailbox_keywords_create() checks keyword validity now and returns failure if
Timo Sirainen <tss@iki.fi>
parents:
6280
diff
changeset
|
414 /* Build mail_keywords from NULL-terminated keywords list. |
23c9ac999578
mailbox_keywords_create() checks keyword validity now and returns failure if
Timo Sirainen <tss@iki.fi>
parents:
6280
diff
changeset
|
415 Returns 0 if successful, -1 if there are invalid keywords (error is set). */ |
6354
8476d665530f
Changed mail_keywords creation APIs to take mailbox/index instead of
Timo Sirainen <tss@iki.fi>
parents:
6353
diff
changeset
|
416 int mailbox_keywords_create(struct mailbox *box, const char *const keywords[], |
6353
23c9ac999578
mailbox_keywords_create() checks keyword validity now and returns failure if
Timo Sirainen <tss@iki.fi>
parents:
6280
diff
changeset
|
417 struct mail_keywords **keywords_r); |
23c9ac999578
mailbox_keywords_create() checks keyword validity now and returns failure if
Timo Sirainen <tss@iki.fi>
parents:
6280
diff
changeset
|
418 /* Like mailbox_keywords_create(), except ignore invalid keywords. */ |
3016
61c8d205d887
Initial support for keywords. Syncing to mbox/maildir doesn't work yet.
Timo Sirainen <tss@iki.fi>
parents:
2996
diff
changeset
|
419 struct mail_keywords * |
6354
8476d665530f
Changed mail_keywords creation APIs to take mailbox/index instead of
Timo Sirainen <tss@iki.fi>
parents:
6353
diff
changeset
|
420 mailbox_keywords_create_valid(struct mailbox *box, |
6353
23c9ac999578
mailbox_keywords_create() checks keyword validity now and returns failure if
Timo Sirainen <tss@iki.fi>
parents:
6280
diff
changeset
|
421 const char *const keywords[]); |
6354
8476d665530f
Changed mail_keywords creation APIs to take mailbox/index instead of
Timo Sirainen <tss@iki.fi>
parents:
6353
diff
changeset
|
422 void mailbox_keywords_free(struct mailbox *box, |
3879
928229f8b3e6
deinit, unref, destroy, close, free, etc. functions now take a pointer to
Timo Sirainen <tss@iki.fi>
parents:
3863
diff
changeset
|
423 struct mail_keywords **keywords); |
8042
0e7a9547be83
Added mailbox_keyword_is_valid().
Timo Sirainen <tss@iki.fi>
parents:
8011
diff
changeset
|
424 /* Returns TRUE if keyword is valid, FALSE and error if not. */ |
0e7a9547be83
Added mailbox_keyword_is_valid().
Timo Sirainen <tss@iki.fi>
parents:
8011
diff
changeset
|
425 bool mailbox_keyword_is_valid(struct mailbox *box, const char *keyword, |
0e7a9547be83
Added mailbox_keyword_is_valid().
Timo Sirainen <tss@iki.fi>
parents:
8011
diff
changeset
|
426 const char **error_r); |
3016
61c8d205d887
Initial support for keywords. Syncing to mbox/maildir doesn't work yet.
Timo Sirainen <tss@iki.fi>
parents:
2996
diff
changeset
|
427 |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
1845
diff
changeset
|
428 /* Convert uid range to sequence range. */ |
7653
f8e902acfbae
Renamed mailbox_get_uids() to mailbox_get_seq_range().
Timo Sirainen <tss@iki.fi>
parents:
7647
diff
changeset
|
429 void mailbox_get_seq_range(struct mailbox *box, uint32_t uid1, uint32_t uid2, |
f8e902acfbae
Renamed mailbox_get_uids() to mailbox_get_seq_range().
Timo Sirainen <tss@iki.fi>
parents:
7647
diff
changeset
|
430 uint32_t *seq1_r, uint32_t *seq2_r); |
7654 | 431 /* Convert sequence range to uid range. If sequences contain |
432 (uint32_t)-1 to specify "*", they're preserved. */ | |
433 void mailbox_get_uid_range(struct mailbox *box, | |
434 const ARRAY_TYPE(seq_range) *seqs, | |
435 ARRAY_TYPE(seq_range) *uids); | |
7629 | 436 /* Get list of UIDs expunged after modseq and within the given range. |
437 UIDs that have been expunged after the last mailbox sync aren't returned. | |
438 Returns TRUE if ok, FALSE if modseq is lower than we can check for. */ | |
439 bool mailbox_get_expunged_uids(struct mailbox *box, uint64_t modseq, | |
440 const ARRAY_TYPE(seq_range) *uids, | |
441 ARRAY_TYPE(seq_range) *expunged_uids); | |
8484
db78eab2ba5d
Initial support for getting full text search working nicely with virtual mailboxes.
Timo Sirainen <tss@iki.fi>
parents:
8468
diff
changeset
|
442 /* If box is a virtual mailbox, look up UID for the given backend message. |
db78eab2ba5d
Initial support for getting full text search working nicely with virtual mailboxes.
Timo Sirainen <tss@iki.fi>
parents:
8468
diff
changeset
|
443 Returns TRUE if found, FALSE if not. */ |
db78eab2ba5d
Initial support for getting full text search working nicely with virtual mailboxes.
Timo Sirainen <tss@iki.fi>
parents:
8468
diff
changeset
|
444 bool mailbox_get_virtual_uid(struct mailbox *box, const char *backend_mailbox, |
db78eab2ba5d
Initial support for getting full text search working nicely with virtual mailboxes.
Timo Sirainen <tss@iki.fi>
parents:
8468
diff
changeset
|
445 uint32_t backend_uidvalidity, |
db78eab2ba5d
Initial support for getting full text search working nicely with virtual mailboxes.
Timo Sirainen <tss@iki.fi>
parents:
8468
diff
changeset
|
446 uint32_t backend_uid, uint32_t *uid_r); |
8495
ffb37c392166
Finished making full text search indexes work fast with virtual mailboxes.
Timo Sirainen <tss@iki.fi>
parents:
8484
diff
changeset
|
447 /* If box is a virtual mailbox, return all backend mailboxes. If |
ffb37c392166
Finished making full text search indexes work fast with virtual mailboxes.
Timo Sirainen <tss@iki.fi>
parents:
8484
diff
changeset
|
448 only_with_msgs=TRUE, return only those mailboxes that have at least one |
ffb37c392166
Finished making full text search indexes work fast with virtual mailboxes.
Timo Sirainen <tss@iki.fi>
parents:
8484
diff
changeset
|
449 message existing in the virtual mailbox. */ |
ffb37c392166
Finished making full text search indexes work fast with virtual mailboxes.
Timo Sirainen <tss@iki.fi>
parents:
8484
diff
changeset
|
450 void mailbox_get_virtual_backend_boxes(struct mailbox *box, |
ffb37c392166
Finished making full text search indexes work fast with virtual mailboxes.
Timo Sirainen <tss@iki.fi>
parents:
8484
diff
changeset
|
451 ARRAY_TYPE(mailboxes) *mailboxes, |
ffb37c392166
Finished making full text search indexes work fast with virtual mailboxes.
Timo Sirainen <tss@iki.fi>
parents:
8484
diff
changeset
|
452 bool only_with_msgs); |
ffb37c392166
Finished making full text search indexes work fast with virtual mailboxes.
Timo Sirainen <tss@iki.fi>
parents:
8484
diff
changeset
|
453 /* If mailbox is a virtual mailbox, return all mailbox list patterns that |
ffb37c392166
Finished making full text search indexes work fast with virtual mailboxes.
Timo Sirainen <tss@iki.fi>
parents:
8484
diff
changeset
|
454 are used to figure out which mailboxes belong to the virtual mailbox. */ |
ffb37c392166
Finished making full text search indexes work fast with virtual mailboxes.
Timo Sirainen <tss@iki.fi>
parents:
8484
diff
changeset
|
455 void mailbox_get_virtual_box_patterns(struct mailbox *box, |
8499
252b29ac5f43
fts: Added support for handling multiple namespaces.
Timo Sirainen <tss@iki.fi>
parents:
8495
diff
changeset
|
456 ARRAY_TYPE(mailbox_virtual_patterns) *includes, |
252b29ac5f43
fts: Added support for handling multiple namespaces.
Timo Sirainen <tss@iki.fi>
parents:
8495
diff
changeset
|
457 ARRAY_TYPE(mailbox_virtual_patterns) *excludes); |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
1845
diff
changeset
|
458 |
2327
7d02e2a7672d
Header caching redesigned. New design allows caching decisions per field, so
Timo Sirainen <tss@iki.fi>
parents:
2322
diff
changeset
|
459 /* 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
|
460 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
|
461 mailbox_header_lookup_init(struct mailbox *box, const char *const headers[]); |
8011
2d902d1f8bea
struct mailbox_header_lookup_ctx can now be referenced/unreferenced so it
Timo Sirainen <tss@iki.fi>
parents:
8006
diff
changeset
|
462 void mailbox_header_lookup_ref(struct mailbox_header_lookup_ctx *ctx); |
2d902d1f8bea
struct mailbox_header_lookup_ctx can now be referenced/unreferenced so it
Timo Sirainen <tss@iki.fi>
parents:
8006
diff
changeset
|
463 void mailbox_header_lookup_unref(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
|
464 |
4303
5f03738219a6
Changed mail-storage API to do the mail sorting internally. Optimized it
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4274
diff
changeset
|
465 /* Initialize new search request. charset specifies the character set used in |
5f03738219a6
Changed mail-storage API to do the mail sorting internally. Optimized it
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4274
diff
changeset
|
466 the search argument strings. If sort_program is non-NULL, the messages are |
5f03738219a6
Changed mail-storage API to do the mail sorting internally. Optimized it
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4274
diff
changeset
|
467 returned in the requested order, otherwise from first to last. */ |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
1845
diff
changeset
|
468 struct mail_search_context * |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
1845
diff
changeset
|
469 mailbox_search_init(struct mailbox_transaction_context *t, |
7642
077bb84e9e77
Make mail_search_args an independent structure that can be used for multiple
Timo Sirainen <tss@iki.fi>
parents:
7631
diff
changeset
|
470 struct mail_search_args *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
|
471 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
|
472 /* 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
|
473 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
|
474 /* 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
|
475 int mailbox_search_next(struct mail_search_context *ctx, struct mail *mail); |
4939
ff2272c228cc
Dovecot is now able to execute multiple commands at the same time.
Timo Sirainen <tss@iki.fi>
parents:
4907
diff
changeset
|
476 /* Like mailbox_search_next(), but don't spend too much time searching. |
ff2272c228cc
Dovecot is now able to execute multiple commands at the same time.
Timo Sirainen <tss@iki.fi>
parents:
4907
diff
changeset
|
477 Returns 1 if found, -1 if failure or 0 with tryagain_r=FALSE if |
ff2272c228cc
Dovecot is now able to execute multiple commands at the same time.
Timo Sirainen <tss@iki.fi>
parents:
4907
diff
changeset
|
478 finished, and TRUE if more results will by calling the function again. */ |
ff2272c228cc
Dovecot is now able to execute multiple commands at the same time.
Timo Sirainen <tss@iki.fi>
parents:
4907
diff
changeset
|
479 int mailbox_search_next_nonblock(struct mail_search_context *ctx, |
ff2272c228cc
Dovecot is now able to execute multiple commands at the same time.
Timo Sirainen <tss@iki.fi>
parents:
4907
diff
changeset
|
480 struct mail *mail, bool *tryagain_r); |
8411
abd0ef855a33
Implemented imap-response-codes draft.
Timo Sirainen <tss@iki.fi>
parents:
8259
diff
changeset
|
481 /* Returns TRUE if some messages were already expunged and we couldn't |
abd0ef855a33
Implemented imap-response-codes draft.
Timo Sirainen <tss@iki.fi>
parents:
8259
diff
changeset
|
482 determine correctly if those messages should have been returned in this |
abd0ef855a33
Implemented imap-response-codes draft.
Timo Sirainen <tss@iki.fi>
parents:
8259
diff
changeset
|
483 search. */ |
abd0ef855a33
Implemented imap-response-codes draft.
Timo Sirainen <tss@iki.fi>
parents:
8259
diff
changeset
|
484 bool mailbox_search_seen_lost_data(struct mail_search_context *ctx); |
1637
a64391b49589
API change for copying messages.
Timo Sirainen <tss@iki.fi>
parents:
1622
diff
changeset
|
485 |
7647
879208fdc7e3
Implemented CONTEXT=SEARCH extension.
Timo Sirainen <tss@iki.fi>
parents:
7642
diff
changeset
|
486 /* Remember the search result for future use. This must be called before the |
879208fdc7e3
Implemented CONTEXT=SEARCH extension.
Timo Sirainen <tss@iki.fi>
parents:
7642
diff
changeset
|
487 first mailbox_search_next*() call. */ |
879208fdc7e3
Implemented CONTEXT=SEARCH extension.
Timo Sirainen <tss@iki.fi>
parents:
7642
diff
changeset
|
488 struct mail_search_result * |
879208fdc7e3
Implemented CONTEXT=SEARCH extension.
Timo Sirainen <tss@iki.fi>
parents:
7642
diff
changeset
|
489 mailbox_search_result_save(struct mail_search_context *ctx, |
879208fdc7e3
Implemented CONTEXT=SEARCH extension.
Timo Sirainen <tss@iki.fi>
parents:
7642
diff
changeset
|
490 enum mailbox_search_result_flags flags); |
879208fdc7e3
Implemented CONTEXT=SEARCH extension.
Timo Sirainen <tss@iki.fi>
parents:
7642
diff
changeset
|
491 /* Free memory used by search result. */ |
879208fdc7e3
Implemented CONTEXT=SEARCH extension.
Timo Sirainen <tss@iki.fi>
parents:
7642
diff
changeset
|
492 void mailbox_search_result_free(struct mail_search_result **result); |
7907
021c39f58af3
Added mailbox_search_result_build().
Timo Sirainen <tss@iki.fi>
parents:
7815
diff
changeset
|
493 /* A simplified API for searching and saving the result. */ |
021c39f58af3
Added mailbox_search_result_build().
Timo Sirainen <tss@iki.fi>
parents:
7815
diff
changeset
|
494 int mailbox_search_result_build(struct mailbox_transaction_context *t, |
021c39f58af3
Added mailbox_search_result_build().
Timo Sirainen <tss@iki.fi>
parents:
7815
diff
changeset
|
495 struct mail_search_args *args, |
021c39f58af3
Added mailbox_search_result_build().
Timo Sirainen <tss@iki.fi>
parents:
7815
diff
changeset
|
496 enum mailbox_search_result_flags flags, |
021c39f58af3
Added mailbox_search_result_build().
Timo Sirainen <tss@iki.fi>
parents:
7815
diff
changeset
|
497 struct mail_search_result **result_r); |
7647
879208fdc7e3
Implemented CONTEXT=SEARCH extension.
Timo Sirainen <tss@iki.fi>
parents:
7642
diff
changeset
|
498 /* Return all messages' UIDs in the search result. */ |
879208fdc7e3
Implemented CONTEXT=SEARCH extension.
Timo Sirainen <tss@iki.fi>
parents:
7642
diff
changeset
|
499 const ARRAY_TYPE(seq_range) * |
879208fdc7e3
Implemented CONTEXT=SEARCH extension.
Timo Sirainen <tss@iki.fi>
parents:
7642
diff
changeset
|
500 mailbox_search_result_get(struct mail_search_result *result); |
879208fdc7e3
Implemented CONTEXT=SEARCH extension.
Timo Sirainen <tss@iki.fi>
parents:
7642
diff
changeset
|
501 /* Return messages that have been removed and added since the last sync call. |
879208fdc7e3
Implemented CONTEXT=SEARCH extension.
Timo Sirainen <tss@iki.fi>
parents:
7642
diff
changeset
|
502 This function must not be called if search result wasn't saved with |
879208fdc7e3
Implemented CONTEXT=SEARCH extension.
Timo Sirainen <tss@iki.fi>
parents:
7642
diff
changeset
|
503 _QUEUE_SYNC flag. */ |
879208fdc7e3
Implemented CONTEXT=SEARCH extension.
Timo Sirainen <tss@iki.fi>
parents:
7642
diff
changeset
|
504 void mailbox_search_result_sync(struct mail_search_result *result, |
879208fdc7e3
Implemented CONTEXT=SEARCH extension.
Timo Sirainen <tss@iki.fi>
parents:
7642
diff
changeset
|
505 ARRAY_TYPE(seq_range) *removed_uids, |
879208fdc7e3
Implemented CONTEXT=SEARCH extension.
Timo Sirainen <tss@iki.fi>
parents:
7642
diff
changeset
|
506 ARRAY_TYPE(seq_range) *added_uids); |
879208fdc7e3
Implemented CONTEXT=SEARCH extension.
Timo Sirainen <tss@iki.fi>
parents:
7642
diff
changeset
|
507 |
8075
8a068f879cd1
mailbox_save_init() API was split to multiple functions.
Timo Sirainen <tss@iki.fi>
parents:
8042
diff
changeset
|
508 /* Initialize saving a new mail. You must not try to save more than one mail |
8a068f879cd1
mailbox_save_init() API was split to multiple functions.
Timo Sirainen <tss@iki.fi>
parents:
8042
diff
changeset
|
509 at a time. */ |
8a068f879cd1
mailbox_save_init() API was split to multiple functions.
Timo Sirainen <tss@iki.fi>
parents:
8042
diff
changeset
|
510 struct mail_save_context * |
8a068f879cd1
mailbox_save_init() API was split to multiple functions.
Timo Sirainen <tss@iki.fi>
parents:
8042
diff
changeset
|
511 mailbox_save_alloc(struct mailbox_transaction_context *t); |
8a068f879cd1
mailbox_save_init() API was split to multiple functions.
Timo Sirainen <tss@iki.fi>
parents:
8042
diff
changeset
|
512 /* Set the flags and keywords. Nothing is set by default. */ |
8a068f879cd1
mailbox_save_init() API was split to multiple functions.
Timo Sirainen <tss@iki.fi>
parents:
8042
diff
changeset
|
513 void mailbox_save_set_flags(struct mail_save_context *ctx, |
8a068f879cd1
mailbox_save_init() API was split to multiple functions.
Timo Sirainen <tss@iki.fi>
parents:
8042
diff
changeset
|
514 enum mail_flags flags, |
8a068f879cd1
mailbox_save_init() API was split to multiple functions.
Timo Sirainen <tss@iki.fi>
parents:
8042
diff
changeset
|
515 struct mail_keywords *keywords); |
8a068f879cd1
mailbox_save_init() API was split to multiple functions.
Timo Sirainen <tss@iki.fi>
parents:
8042
diff
changeset
|
516 /* If received date isn't specified the current time is used. timezone_offset |
8a068f879cd1
mailbox_save_init() API was split to multiple functions.
Timo Sirainen <tss@iki.fi>
parents:
8042
diff
changeset
|
517 specifies the preferred timezone in minutes, but it may be ignored if |
8a068f879cd1
mailbox_save_init() API was split to multiple functions.
Timo Sirainen <tss@iki.fi>
parents:
8042
diff
changeset
|
518 backend doesn't support storing it. */ |
8a068f879cd1
mailbox_save_init() API was split to multiple functions.
Timo Sirainen <tss@iki.fi>
parents:
8042
diff
changeset
|
519 void mailbox_save_set_received_date(struct mail_save_context *ctx, |
8a068f879cd1
mailbox_save_init() API was split to multiple functions.
Timo Sirainen <tss@iki.fi>
parents:
8042
diff
changeset
|
520 time_t received_date, int timezone_offset); |
8a068f879cd1
mailbox_save_init() API was split to multiple functions.
Timo Sirainen <tss@iki.fi>
parents:
8042
diff
changeset
|
521 /* Set the envelope sender. This is currently used only with mbox files to |
8a068f879cd1
mailbox_save_init() API was split to multiple functions.
Timo Sirainen <tss@iki.fi>
parents:
8042
diff
changeset
|
522 specify the address in From_-line. */ |
8a068f879cd1
mailbox_save_init() API was split to multiple functions.
Timo Sirainen <tss@iki.fi>
parents:
8042
diff
changeset
|
523 void mailbox_save_set_from_envelope(struct mail_save_context *ctx, |
8a068f879cd1
mailbox_save_init() API was split to multiple functions.
Timo Sirainen <tss@iki.fi>
parents:
8042
diff
changeset
|
524 const char *envelope); |
8077
6d51328896d6
Added the concept of Global UIDs that are preserved across copies.
Timo Sirainen <tss@iki.fi>
parents:
8075
diff
changeset
|
525 /* Set globally unique ID for the saved mail. A new GUID is generated by |
6d51328896d6
Added the concept of Global UIDs that are preserved across copies.
Timo Sirainen <tss@iki.fi>
parents:
8075
diff
changeset
|
526 default. This function should usually be called only when copying an |
6d51328896d6
Added the concept of Global UIDs that are preserved across copies.
Timo Sirainen <tss@iki.fi>
parents:
8075
diff
changeset
|
527 existing mail (or restoring a mail from backup). */ |
6d51328896d6
Added the concept of Global UIDs that are preserved across copies.
Timo Sirainen <tss@iki.fi>
parents:
8075
diff
changeset
|
528 void mailbox_save_set_guid(struct mail_save_context *ctx, const char *guid); |
8075
8a068f879cd1
mailbox_save_init() API was split to multiple functions.
Timo Sirainen <tss@iki.fi>
parents:
8042
diff
changeset
|
529 /* If dest_mail is set, the saved message can be accessed using it. Note that |
4268
7112aad504ae
Changed mailbox_save_*() API a bit: Moved the struct mail *dest_mail to
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4152
diff
changeset
|
530 setting it may require mailbox syncing, so don't set it unless you need |
7112aad504ae
Changed mailbox_save_*() API a bit: Moved the struct mail *dest_mail to
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4152
diff
changeset
|
531 it. Also you shouldn't try to access it before mailbox_save_finish() is |
8075
8a068f879cd1
mailbox_save_init() API was split to multiple functions.
Timo Sirainen <tss@iki.fi>
parents:
8042
diff
changeset
|
532 called. */ |
8a068f879cd1
mailbox_save_init() API was split to multiple functions.
Timo Sirainen <tss@iki.fi>
parents:
8042
diff
changeset
|
533 void mailbox_save_set_dest_mail(struct mail_save_context *ctx, |
8a068f879cd1
mailbox_save_init() API was split to multiple functions.
Timo Sirainen <tss@iki.fi>
parents:
8042
diff
changeset
|
534 struct mail *mail); |
8a068f879cd1
mailbox_save_init() API was split to multiple functions.
Timo Sirainen <tss@iki.fi>
parents:
8042
diff
changeset
|
535 /* Begin saving the message. All mail_save_set_*() calls must have been called |
8a068f879cd1
mailbox_save_init() API was split to multiple functions.
Timo Sirainen <tss@iki.fi>
parents:
8042
diff
changeset
|
536 before this function. If the save initialization fails, the context is freed |
8a068f879cd1
mailbox_save_init() API was split to multiple functions.
Timo Sirainen <tss@iki.fi>
parents:
8042
diff
changeset
|
537 and -1 is returned. After beginning the save you should keep calling |
8a068f879cd1
mailbox_save_init() API was split to multiple functions.
Timo Sirainen <tss@iki.fi>
parents:
8042
diff
changeset
|
538 i_stream_read() and calling mailbox_save_continue() as long as there's |
8a068f879cd1
mailbox_save_init() API was split to multiple functions.
Timo Sirainen <tss@iki.fi>
parents:
8042
diff
changeset
|
539 more input. */ |
8a068f879cd1
mailbox_save_init() API was split to multiple functions.
Timo Sirainen <tss@iki.fi>
parents:
8042
diff
changeset
|
540 int mailbox_save_begin(struct mail_save_context **ctx, struct istream *input); |
2446
47e1e05cede0
Changed mail saving API to be nonblocking.
Timo Sirainen <tss@iki.fi>
parents:
2422
diff
changeset
|
541 int mailbox_save_continue(struct mail_save_context *ctx); |
4268
7112aad504ae
Changed mailbox_save_*() API a bit: Moved the struct mail *dest_mail to
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4152
diff
changeset
|
542 int mailbox_save_finish(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
|
543 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
|
544 |
8726
68db63cc32b3
Mail copying API changed to be based on save API. This allows extending it easily in future.
Timo Sirainen <tss@iki.fi>
parents:
8499
diff
changeset
|
545 /* Copy the given message. You'll need to specify the flags etc. using the |
68db63cc32b3
Mail copying API changed to be based on save API. This allows extending it easily in future.
Timo Sirainen <tss@iki.fi>
parents:
8499
diff
changeset
|
546 mailbox_save_*() functions. */ |
68db63cc32b3
Mail copying API changed to be based on save API. This allows extending it easily in future.
Timo Sirainen <tss@iki.fi>
parents:
8499
diff
changeset
|
547 int mailbox_copy(struct mail_save_context **ctx, struct mail *mail); |
1640
db14aa8e2b5c
API change for expunging messages. Not exactly what I wanted, but good
Timo Sirainen <tss@iki.fi>
parents:
1639
diff
changeset
|
548 |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
1845
diff
changeset
|
549 /* 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
|
550 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
|
551 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
|
552 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
|
553 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
|
554 bool mailbox_is_inconsistent(struct mailbox *box); |
0 | 555 |
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
|
556 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
|
557 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
|
558 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
|
559 void mail_free(struct mail **mail); |
6277
5f66277bbe40
mail_index_lookup*() can't fail anymore. Changed several APIs not to return
Timo Sirainen <tss@iki.fi>
parents:
6275
diff
changeset
|
560 void mail_set_seq(struct mail *mail, uint32_t seq); |
5f66277bbe40
mail_index_lookup*() can't fail anymore. Changed several APIs not to return
Timo Sirainen <tss@iki.fi>
parents:
6275
diff
changeset
|
561 /* Returns TRUE if successful, FALSE if message doesn't exist. |
5f66277bbe40
mail_index_lookup*() can't fail anymore. Changed several APIs not to return
Timo Sirainen <tss@iki.fi>
parents:
6275
diff
changeset
|
562 mail_*() functions shouldn't be called if FALSE is returned. */ |
5f66277bbe40
mail_index_lookup*() can't fail anymore. Changed several APIs not to return
Timo Sirainen <tss@iki.fi>
parents:
6275
diff
changeset
|
563 bool mail_set_uid(struct mail *mail, uint32_t uid); |
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
|
564 |
6280
eb7c9d8ece54
mail_*() APIs changed to return int and return the actual data as pointer.
Timo Sirainen <tss@iki.fi>
parents:
6279
diff
changeset
|
565 /* Returns message's flags */ |
eb7c9d8ece54
mail_*() APIs changed to return int and return the actual data as pointer.
Timo Sirainen <tss@iki.fi>
parents:
6279
diff
changeset
|
566 enum mail_flags mail_get_flags(struct mail *mail); |
eb7c9d8ece54
mail_*() APIs changed to return int and return the actual data as pointer.
Timo Sirainen <tss@iki.fi>
parents:
6279
diff
changeset
|
567 /* Returns message's keywords */ |
eb7c9d8ece54
mail_*() APIs changed to return int and return the actual data as pointer.
Timo Sirainen <tss@iki.fi>
parents:
6279
diff
changeset
|
568 const char *const *mail_get_keywords(struct mail *mail); |
6985
58b8daf695bf
Added mail_get_keyword_indexes()
Timo Sirainen <tss@iki.fi>
parents:
6751
diff
changeset
|
569 /* Returns message's keywords */ |
58b8daf695bf
Added mail_get_keyword_indexes()
Timo Sirainen <tss@iki.fi>
parents:
6751
diff
changeset
|
570 const ARRAY_TYPE(keyword_indexes) *mail_get_keyword_indexes(struct mail *mail); |
7620 | 571 /* Returns message's modseq */ |
572 uint64_t mail_get_modseq(struct mail *mail); | |
6280
eb7c9d8ece54
mail_*() APIs changed to return int and return the actual data as pointer.
Timo Sirainen <tss@iki.fi>
parents:
6279
diff
changeset
|
573 |
eb7c9d8ece54
mail_*() APIs changed to return int and return the actual data as pointer.
Timo Sirainen <tss@iki.fi>
parents:
6279
diff
changeset
|
574 /* Returns message's MIME parts */ |
eb7c9d8ece54
mail_*() APIs changed to return int and return the actual data as pointer.
Timo Sirainen <tss@iki.fi>
parents:
6279
diff
changeset
|
575 int mail_get_parts(struct mail *mail, const struct message_part **parts_r); |
eb7c9d8ece54
mail_*() APIs changed to return int and return the actual data as pointer.
Timo Sirainen <tss@iki.fi>
parents:
6279
diff
changeset
|
576 |
eb7c9d8ece54
mail_*() APIs changed to return int and return the actual data as pointer.
Timo Sirainen <tss@iki.fi>
parents:
6279
diff
changeset
|
577 /* Get the Date-header of the mail. Timezone is in minutes. date=0 if it |
eb7c9d8ece54
mail_*() APIs changed to return int and return the actual data as pointer.
Timo Sirainen <tss@iki.fi>
parents:
6279
diff
changeset
|
578 wasn't found or it was invalid. */ |
eb7c9d8ece54
mail_*() APIs changed to return int and return the actual data as pointer.
Timo Sirainen <tss@iki.fi>
parents:
6279
diff
changeset
|
579 int mail_get_date(struct mail *mail, time_t *date_r, int *timezone_r); |
eb7c9d8ece54
mail_*() APIs changed to return int and return the actual data as pointer.
Timo Sirainen <tss@iki.fi>
parents:
6279
diff
changeset
|
580 /* Get the time when the mail was received (IMAP INTERNALDATE). */ |
eb7c9d8ece54
mail_*() APIs changed to return int and return the actual data as pointer.
Timo Sirainen <tss@iki.fi>
parents:
6279
diff
changeset
|
581 int mail_get_received_date(struct mail *mail, time_t *date_r); |
4455
fce5140fbe0b
Added mail_get_save_date() and some cleanups.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4451
diff
changeset
|
582 /* Get the time when the mail was saved into this mailbox. This time may not |
6280
eb7c9d8ece54
mail_*() APIs changed to return int and return the actual data as pointer.
Timo Sirainen <tss@iki.fi>
parents:
6279
diff
changeset
|
583 always be entirely reliable. */ |
eb7c9d8ece54
mail_*() APIs changed to return int and return the actual data as pointer.
Timo Sirainen <tss@iki.fi>
parents:
6279
diff
changeset
|
584 int mail_get_save_date(struct mail *mail, time_t *date_r); |
988
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
585 |
4455
fce5140fbe0b
Added mail_get_save_date() and some cleanups.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4451
diff
changeset
|
586 /* Get the space used by the mail as seen by the reader. Linefeeds are always |
6280
eb7c9d8ece54
mail_*() APIs changed to return int and return the actual data as pointer.
Timo Sirainen <tss@iki.fi>
parents:
6279
diff
changeset
|
587 counted as being CR+LF. */ |
eb7c9d8ece54
mail_*() APIs changed to return int and return the actual data as pointer.
Timo Sirainen <tss@iki.fi>
parents:
6279
diff
changeset
|
588 int mail_get_virtual_size(struct mail *mail, uoff_t *size_r); |
7016
ac32dc7ae0c1
mail_get_physical_size() returns now the message stream's size and not the
Timo Sirainen <tss@iki.fi>
parents:
6985
diff
changeset
|
589 /* Get the size of the stream returned by mail_get_stream(). */ |
6280
eb7c9d8ece54
mail_*() APIs changed to return int and return the actual data as pointer.
Timo Sirainen <tss@iki.fi>
parents:
6279
diff
changeset
|
590 int mail_get_physical_size(struct mail *mail, uoff_t *size_r); |
988
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
591 |
6280
eb7c9d8ece54
mail_*() APIs changed to return int and return the actual data as pointer.
Timo Sirainen <tss@iki.fi>
parents:
6279
diff
changeset
|
592 /* Get value for single header field, or NULL if header wasn't found. |
eb7c9d8ece54
mail_*() APIs changed to return int and return the actual data as pointer.
Timo Sirainen <tss@iki.fi>
parents:
6279
diff
changeset
|
593 Returns 1 if header was found, 0 if not, -1 if error. */ |
eb7c9d8ece54
mail_*() APIs changed to return int and return the actual data as pointer.
Timo Sirainen <tss@iki.fi>
parents:
6279
diff
changeset
|
594 int mail_get_first_header(struct mail *mail, const char *field, |
eb7c9d8ece54
mail_*() APIs changed to return int and return the actual data as pointer.
Timo Sirainen <tss@iki.fi>
parents:
6279
diff
changeset
|
595 const char **value_r); |
8453
1d542b149bed
mail_get_headers_utf8() and mail_get_first_header_utf8() return headers unfolded now.
Timo Sirainen <tss@iki.fi>
parents:
8428
diff
changeset
|
596 /* Like mail_get_first_header(), but decode MIME encoded words to UTF-8. |
1d542b149bed
mail_get_headers_utf8() and mail_get_first_header_utf8() return headers unfolded now.
Timo Sirainen <tss@iki.fi>
parents:
8428
diff
changeset
|
597 Also multiline headers are returned unfolded. */ |
6280
eb7c9d8ece54
mail_*() APIs changed to return int and return the actual data as pointer.
Timo Sirainen <tss@iki.fi>
parents:
6279
diff
changeset
|
598 int mail_get_first_header_utf8(struct mail *mail, const char *field, |
eb7c9d8ece54
mail_*() APIs changed to return int and return the actual data as pointer.
Timo Sirainen <tss@iki.fi>
parents:
6279
diff
changeset
|
599 const char **value_r); |
3248
ff47e78ad717
Renamed mail_get_header() to mail_get_first_header() and mail_gets_headers()
Timo Sirainen <tss@iki.fi>
parents:
3245
diff
changeset
|
600 /* Return a NULL-terminated list of values for each found field. */ |
6280
eb7c9d8ece54
mail_*() APIs changed to return int and return the actual data as pointer.
Timo Sirainen <tss@iki.fi>
parents:
6279
diff
changeset
|
601 int mail_get_headers(struct mail *mail, const char *field, |
eb7c9d8ece54
mail_*() APIs changed to return int and return the actual data as pointer.
Timo Sirainen <tss@iki.fi>
parents:
6279
diff
changeset
|
602 const char *const **value_r); |
8453
1d542b149bed
mail_get_headers_utf8() and mail_get_first_header_utf8() return headers unfolded now.
Timo Sirainen <tss@iki.fi>
parents:
8428
diff
changeset
|
603 /* Like mail_get_headers(), but decode MIME encoded words to UTF-8. |
1d542b149bed
mail_get_headers_utf8() and mail_get_first_header_utf8() return headers unfolded now.
Timo Sirainen <tss@iki.fi>
parents:
8428
diff
changeset
|
604 Also multiline headers are returned unfolded. */ |
6280
eb7c9d8ece54
mail_*() APIs changed to return int and return the actual data as pointer.
Timo Sirainen <tss@iki.fi>
parents:
6279
diff
changeset
|
605 int mail_get_headers_utf8(struct mail *mail, const char *field, |
eb7c9d8ece54
mail_*() APIs changed to return int and return the actual data as pointer.
Timo Sirainen <tss@iki.fi>
parents:
6279
diff
changeset
|
606 const char *const **value_r); |
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
|
607 /* Returns stream containing specified headers. */ |
6280
eb7c9d8ece54
mail_*() APIs changed to return int and return the actual data as pointer.
Timo Sirainen <tss@iki.fi>
parents:
6279
diff
changeset
|
608 int mail_get_header_stream(struct mail *mail, |
eb7c9d8ece54
mail_*() APIs changed to return int and return the actual data as pointer.
Timo Sirainen <tss@iki.fi>
parents:
6279
diff
changeset
|
609 struct mailbox_header_lookup_ctx *headers, |
eb7c9d8ece54
mail_*() APIs changed to return int and return the actual data as pointer.
Timo Sirainen <tss@iki.fi>
parents:
6279
diff
changeset
|
610 struct istream **stream_r); |
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
|
611 /* 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
|
612 hdr_size and body_size are updated unless they're NULL. */ |
6280
eb7c9d8ece54
mail_*() APIs changed to return int and return the actual data as pointer.
Timo Sirainen <tss@iki.fi>
parents:
6279
diff
changeset
|
613 int mail_get_stream(struct mail *mail, struct message_size *hdr_size, |
eb7c9d8ece54
mail_*() APIs changed to return int and return the actual data as pointer.
Timo Sirainen <tss@iki.fi>
parents:
6279
diff
changeset
|
614 struct message_size *body_size, struct istream **stream_r); |
1637
a64391b49589
API change for copying messages.
Timo Sirainen <tss@iki.fi>
parents:
1622
diff
changeset
|
615 |
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
|
616 /* Get any of the "special" fields. */ |
6280
eb7c9d8ece54
mail_*() APIs changed to return int and return the actual data as pointer.
Timo Sirainen <tss@iki.fi>
parents:
6279
diff
changeset
|
617 int mail_get_special(struct mail *mail, enum mail_fetch_field field, |
eb7c9d8ece54
mail_*() APIs changed to return int and return the actual data as pointer.
Timo Sirainen <tss@iki.fi>
parents:
6279
diff
changeset
|
618 const char **value_r); |
1638
e95c0e462591
API change for updating message flags.
Timo Sirainen <tss@iki.fi>
parents:
1637
diff
changeset
|
619 |
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
|
620 /* Update message flags. */ |
6277
5f66277bbe40
mail_index_lookup*() can't fail anymore. Changed several APIs not to return
Timo Sirainen <tss@iki.fi>
parents:
6275
diff
changeset
|
621 void mail_update_flags(struct mail *mail, enum modify_type modify_type, |
5f66277bbe40
mail_index_lookup*() can't fail anymore. Changed several APIs not to return
Timo Sirainen <tss@iki.fi>
parents:
6275
diff
changeset
|
622 enum mail_flags flags); |
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
|
623 /* Update message keywords. */ |
6277
5f66277bbe40
mail_index_lookup*() can't fail anymore. Changed several APIs not to return
Timo Sirainen <tss@iki.fi>
parents:
6275
diff
changeset
|
624 void mail_update_keywords(struct mail *mail, enum modify_type modify_type, |
5f66277bbe40
mail_index_lookup*() can't fail anymore. Changed several APIs not to return
Timo Sirainen <tss@iki.fi>
parents:
6275
diff
changeset
|
625 struct mail_keywords *keywords); |
9348 | 626 void mail_update_pop3_uidl(struct mail *mail, const char *uidl); |
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
|
627 |
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
|
628 /* Expunge this message. Sequence numbers don't change until commit. */ |
6277
5f66277bbe40
mail_index_lookup*() can't fail anymore. Changed several APIs not to return
Timo Sirainen <tss@iki.fi>
parents:
6275
diff
changeset
|
629 void mail_expunge(struct mail *mail); |
7241
a6c066f50877
Added mail_set_cache_corrupted() to rebuild the cache file and force
Timo Sirainen <tss@iki.fi>
parents:
7128
diff
changeset
|
630 /* Mark a cached field corrupted and have it recalculated. */ |
a6c066f50877
Added mail_set_cache_corrupted() to rebuild the cache file and force
Timo Sirainen <tss@iki.fi>
parents:
7128
diff
changeset
|
631 void mail_set_cache_corrupted(struct mail *mail, enum mail_fetch_field field); |
450
925d6eb5f8be
MailStorage interface change. We now let storage call several sync-functions
Timo Sirainen <tss@iki.fi>
parents:
410
diff
changeset
|
632 |
0 | 633 #endif |