Mercurial > dovecot > original-hg > dovecot-1.2
annotate src/lib-storage/mail-storage.h @ 1151:058f6c26f405 HEAD
Added mail_full_filesystem_access setting. Some of the setting variable
types were declared wrong and caused Dovecot to crash if they were set in
config file.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Tue, 11 Feb 2003 21:37:16 +0200 |
parents | 340dea0150bf |
children | f7c273202dc3 |
rev | line source |
---|---|
0 | 1 #ifndef __MAIL_STORAGE_H |
2 #define __MAIL_STORAGE_H | |
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 |
0 | 6 #include "imap-util.h" |
7 | |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
8 enum mailbox_flags { |
0 | 9 MAILBOX_NOSELECT = 0x01, |
10 MAILBOX_CHILDREN = 0x02, | |
11 MAILBOX_NOCHILDREN = 0x04, | |
12 MAILBOX_NOINFERIORS = 0x08, | |
13 MAILBOX_MARKED = 0x10, | |
14 MAILBOX_UNMARKED = 0x20, | |
15 | |
16 MAILBOX_READONLY = 0x40 | |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
17 }; |
0 | 18 |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
19 enum mailbox_status_items { |
0 | 20 STATUS_MESSAGES = 0x01, |
21 STATUS_RECENT = 0x02, | |
22 STATUS_UIDNEXT = 0x04, | |
23 STATUS_UIDVALIDITY = 0x08, | |
24 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
|
25 STATUS_FIRST_UNSEEN_SEQ = 0x20, |
867ec80dbf42
Custom flags are now shown in FLAGS and PERMANENTFLAGS lists after SELECT.
Timo Sirainen <tss@iki.fi>
parents:
50
diff
changeset
|
26 STATUS_CUSTOM_FLAGS = 0x40 |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
27 }; |
0 | 28 |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
29 enum mailbox_name_status { |
0 | 30 MAILBOX_NAME_EXISTS, |
31 MAILBOX_NAME_VALID, | |
889 | 32 MAILBOX_NAME_INVALID, |
33 MAILBOX_NAME_NOINFERIORS | |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
34 }; |
0 | 35 |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
36 enum modify_type { |
0 | 37 MODIFY_ADD, |
38 MODIFY_REMOVE, | |
39 MODIFY_REPLACE | |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
40 }; |
0 | 41 |
906
b176f913d092
"ISO C forbids forward references to enum types"
Timo Sirainen <tss@iki.fi>
parents:
903
diff
changeset
|
42 enum mail_sort_type { |
988
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
43 /* Maximum size for sort program, 2x for reverse + END */ |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
44 #define MAX_SORT_PROGRAM_SIZE (2*7 + 1) |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
45 |
906
b176f913d092
"ISO C forbids forward references to enum types"
Timo Sirainen <tss@iki.fi>
parents:
903
diff
changeset
|
46 MAIL_SORT_ARRIVAL = 0x0010, |
b176f913d092
"ISO C forbids forward references to enum types"
Timo Sirainen <tss@iki.fi>
parents:
903
diff
changeset
|
47 MAIL_SORT_CC = 0x0020, |
b176f913d092
"ISO C forbids forward references to enum types"
Timo Sirainen <tss@iki.fi>
parents:
903
diff
changeset
|
48 MAIL_SORT_DATE = 0x0040, |
b176f913d092
"ISO C forbids forward references to enum types"
Timo Sirainen <tss@iki.fi>
parents:
903
diff
changeset
|
49 MAIL_SORT_FROM = 0x0080, |
b176f913d092
"ISO C forbids forward references to enum types"
Timo Sirainen <tss@iki.fi>
parents:
903
diff
changeset
|
50 MAIL_SORT_SIZE = 0x0100, |
b176f913d092
"ISO C forbids forward references to enum types"
Timo Sirainen <tss@iki.fi>
parents:
903
diff
changeset
|
51 MAIL_SORT_SUBJECT = 0x0200, |
b176f913d092
"ISO C forbids forward references to enum types"
Timo Sirainen <tss@iki.fi>
parents:
903
diff
changeset
|
52 MAIL_SORT_TO = 0x0400, |
b176f913d092
"ISO C forbids forward references to enum types"
Timo Sirainen <tss@iki.fi>
parents:
903
diff
changeset
|
53 |
b176f913d092
"ISO C forbids forward references to enum types"
Timo Sirainen <tss@iki.fi>
parents:
903
diff
changeset
|
54 MAIL_SORT_REVERSE = 0x0001, /* reverse the next type */ |
b176f913d092
"ISO C forbids forward references to enum types"
Timo Sirainen <tss@iki.fi>
parents:
903
diff
changeset
|
55 |
b176f913d092
"ISO C forbids forward references to enum types"
Timo Sirainen <tss@iki.fi>
parents:
903
diff
changeset
|
56 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
|
57 }; |
b176f913d092
"ISO C forbids forward references to enum types"
Timo Sirainen <tss@iki.fi>
parents:
903
diff
changeset
|
58 |
924
4f697dde0fca
THREAD=REFERENCES implementation. Doesn't crash, but I'm not sure how
Timo Sirainen <tss@iki.fi>
parents:
906
diff
changeset
|
59 enum mail_thread_type { |
4f697dde0fca
THREAD=REFERENCES implementation. Doesn't crash, but I'm not sure how
Timo Sirainen <tss@iki.fi>
parents:
906
diff
changeset
|
60 MAIL_THREAD_NONE, |
4f697dde0fca
THREAD=REFERENCES implementation. Doesn't crash, but I'm not sure how
Timo Sirainen <tss@iki.fi>
parents:
906
diff
changeset
|
61 MAIL_THREAD_ORDEREDSUBJECT, |
4f697dde0fca
THREAD=REFERENCES implementation. Doesn't crash, but I'm not sure how
Timo Sirainen <tss@iki.fi>
parents:
906
diff
changeset
|
62 MAIL_THREAD_REFERENCES |
4f697dde0fca
THREAD=REFERENCES implementation. Doesn't crash, but I'm not sure how
Timo Sirainen <tss@iki.fi>
parents:
906
diff
changeset
|
63 }; |
4f697dde0fca
THREAD=REFERENCES implementation. Doesn't crash, but I'm not sure how
Timo Sirainen <tss@iki.fi>
parents:
906
diff
changeset
|
64 |
988
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
65 enum mail_fetch_field { |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
66 MAIL_FETCH_FLAGS = 0x0001, |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
67 MAIL_FETCH_MESSAGE_PARTS = 0x0002, |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
68 |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
69 MAIL_FETCH_RECEIVED_DATE = 0x0004, |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
70 MAIL_FETCH_DATE = 0x0008, |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
71 MAIL_FETCH_SIZE = 0x0010, |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
72 |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
73 MAIL_FETCH_STREAM_HEADER = 0x0020, |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
74 MAIL_FETCH_STREAM_BODY = 0x0040, |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
75 |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
76 /* specials: */ |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
77 MAIL_FETCH_IMAP_BODY = 0x1000, |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
78 MAIL_FETCH_IMAP_BODYSTRUCTURE = 0x2000, |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
79 MAIL_FETCH_IMAP_ENVELOPE = 0x4000 |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
80 }; |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
81 |
1138
340dea0150bf
Added client_workarounds setting, with currently one workaround for OE6.
Timo Sirainen <tss@iki.fi>
parents:
1038
diff
changeset
|
82 enum client_workarounds { |
340dea0150bf
Added client_workarounds setting, with currently one workaround for OE6.
Timo Sirainen <tss@iki.fi>
parents:
1038
diff
changeset
|
83 WORKAROUND_OE6_FETCH_NO_NEWMAIL |
340dea0150bf
Added client_workarounds setting, with currently one workaround for OE6.
Timo Sirainen <tss@iki.fi>
parents:
1038
diff
changeset
|
84 }; |
340dea0150bf
Added client_workarounds setting, with currently one workaround for OE6.
Timo Sirainen <tss@iki.fi>
parents:
1038
diff
changeset
|
85 |
988
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
86 struct mail_full_flags { |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
87 enum mail_flags flags; |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
88 |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
89 const char **custom_flags; |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
90 unsigned int custom_flags_count; |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
91 }; |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
92 |
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 struct mail_storage; |
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
94 struct mail_storage_callbacks; |
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
95 struct mailbox_status; |
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
96 struct mail_search_arg; |
988
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
97 struct fetch_context; |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
98 struct search_context; |
0 | 99 |
1038
60646878858e
Function typedefs now define them as functions, not function pointers.
Timo Sirainen <tss@iki.fi>
parents:
1015
diff
changeset
|
100 typedef void mailbox_list_callback_t(struct mail_storage *storage, |
60646878858e
Function typedefs now define them as functions, not function pointers.
Timo Sirainen <tss@iki.fi>
parents:
1015
diff
changeset
|
101 const char *name, enum mailbox_flags flags, |
60646878858e
Function typedefs now define them as functions, not function pointers.
Timo Sirainen <tss@iki.fi>
parents:
1015
diff
changeset
|
102 void *context); |
0 | 103 |
104 /* All methods returning int return either TRUE or FALSE. */ | |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
105 struct mail_storage { |
0 | 106 char *name; |
107 | |
108 char hierarchy_sep; | |
109 | |
110 /* Create new instance */ | |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
111 struct mail_storage *(*create)(const char *data, const char *user); |
0 | 112 |
113 /* Free this instance */ | |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
114 void (*free)(struct mail_storage *storage); |
0 | 115 |
116 /* Returns TRUE if this storage would accept the given data | |
117 as a valid parameter to create(). */ | |
118 int (*autodetect)(const char *data); | |
119 | |
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
|
120 /* Set storage callback functions to use. */ |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
121 void (*set_callbacks)(struct mail_storage *storage, |
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
122 struct mail_storage_callbacks *callbacks, |
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
123 void *context); |
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
|
124 |
0 | 125 /* Open a mailbox. If readonly is TRUE, mailbox must not be |
296
d66aa1f1fb2d
Added fast-flag for mailbox opening, which doesn't do any index compressing
Timo Sirainen <tss@iki.fi>
parents:
184
diff
changeset
|
126 modified in any way even when it's asked. If fast is TRUE, |
d66aa1f1fb2d
Added fast-flag for mailbox opening, which doesn't do any index compressing
Timo Sirainen <tss@iki.fi>
parents:
184
diff
changeset
|
127 any extra time consuming operations shouldn't be performed |
450
925d6eb5f8be
MailStorage interface change. We now let storage call several sync-functions
Timo Sirainen <tss@iki.fi>
parents:
410
diff
changeset
|
128 (eg. when opening mailbox just for STATUS). |
925d6eb5f8be
MailStorage interface change. We now let storage call several sync-functions
Timo Sirainen <tss@iki.fi>
parents:
410
diff
changeset
|
129 |
925d6eb5f8be
MailStorage interface change. We now let storage call several sync-functions
Timo Sirainen <tss@iki.fi>
parents:
410
diff
changeset
|
130 Note that append and copy may open the selected mailbox again |
925d6eb5f8be
MailStorage interface change. We now let storage call several sync-functions
Timo Sirainen <tss@iki.fi>
parents:
410
diff
changeset
|
131 with possibly different readonly-state. */ |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
132 struct mailbox *(*open_mailbox)(struct mail_storage *storage, |
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
133 const char *name, |
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
134 int readonly, int fast); |
0 | 135 |
889 | 136 /* name is allowed to contain multiple new hierarchy levels. */ |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
137 int (*create_mailbox)(struct mail_storage *storage, const char *name); |
889 | 138 |
139 /* Only the specified mailbox is deleted, ie. folders under the | |
140 specified mailbox must not be deleted. */ | |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
141 int (*delete_mailbox)(struct mail_storage *storage, const char *name); |
450
925d6eb5f8be
MailStorage interface change. We now let storage call several sync-functions
Timo Sirainen <tss@iki.fi>
parents:
410
diff
changeset
|
142 |
0 | 143 /* If the name has inferior hierarchical names, then the inferior |
144 hierarchical names MUST also be renamed (ie. foo -> bar renames | |
889 | 145 also foo/bar -> bar/bar). newname may contain multiple new |
146 hierarchies. | |
0 | 147 |
148 If oldname is case-insensitively "INBOX", the mails are moved | |
149 into new folder but the INBOX folder must not be deleted. */ | |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
150 int (*rename_mailbox)(struct mail_storage *storage, const char *oldname, |
0 | 151 const char *newname); |
152 | |
153 /* Execute specified function for all mailboxes matching given | |
154 mask. The mask is in RFC2060 LIST format. */ | |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
155 int (*find_mailboxes)(struct mail_storage *storage, const char *mask, |
1038
60646878858e
Function typedefs now define them as functions, not function pointers.
Timo Sirainen <tss@iki.fi>
parents:
1015
diff
changeset
|
156 mailbox_list_callback_t *callback, void *context); |
0 | 157 |
158 /* Subscribe/unsubscribe mailbox. There should be no error when | |
159 subscribing to already subscribed mailbox. Subscribing to | |
160 unexisting mailboxes is optional. */ | |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
161 int (*set_subscribed)(struct mail_storage *storage, |
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
162 const char *name, int set); |
0 | 163 |
164 /* Exactly like find_mailboxes(), but list only subscribed mailboxes. */ | |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
165 int (*find_subscribed)(struct mail_storage *storage, const char *mask, |
1038
60646878858e
Function typedefs now define them as functions, not function pointers.
Timo Sirainen <tss@iki.fi>
parents:
1015
diff
changeset
|
166 mailbox_list_callback_t *callback, |
60646878858e
Function typedefs now define them as functions, not function pointers.
Timo Sirainen <tss@iki.fi>
parents:
1015
diff
changeset
|
167 void *context); |
0 | 168 |
169 /* Returns mailbox name status */ | |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
170 int (*get_mailbox_name_status)(struct mail_storage *storage, |
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
171 const char *name, |
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
172 enum mailbox_name_status *status); |
0 | 173 |
174 /* Returns the error message of last occured error. */ | |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
175 const char *(*get_last_error)(struct mail_storage *storage, |
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
176 int *syntax_error); |
0 | 177 |
178 /* private: */ | |
179 char *dir; /* root directory */ | |
815
ef64c9a50326
Support for separate location of mbox INBOX folder.
Timo Sirainen <tss@iki.fi>
parents:
764
diff
changeset
|
180 char *inbox_file; /* INBOX file for mbox */ |
817
86cf24da85f1
Added :INDEX=<dir> for both Maildir and mbox to specify different location
Timo Sirainen <tss@iki.fi>
parents:
815
diff
changeset
|
181 char *index_dir; |
86cf24da85f1
Added :INDEX=<dir> for both Maildir and mbox to specify different location
Timo Sirainen <tss@iki.fi>
parents:
815
diff
changeset
|
182 |
22
a946ce1f09b7
mbox fixes, not fully working yet but almost :)
Timo Sirainen <tss@iki.fi>
parents:
13
diff
changeset
|
183 char *user; /* name of user accessing the storage */ |
0 | 184 char *error; |
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
|
185 |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
186 struct mail_storage_callbacks *callbacks; |
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
|
187 void *callback_context; |
883
39e0b536e708
Storage can now specify if errors should be sent to user as BAD or NO.
Timo Sirainen <tss@iki.fi>
parents:
817
diff
changeset
|
188 |
39e0b536e708
Storage can now specify if errors should be sent to user as BAD or NO.
Timo Sirainen <tss@iki.fi>
parents:
817
diff
changeset
|
189 unsigned int syntax_error:1; /* Give a BAD reply instead of NO */ |
0 | 190 }; |
191 | |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
192 struct mailbox { |
0 | 193 char *name; |
194 | |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
195 struct mail_storage *storage; |
0 | 196 |
559
c834e77b624c
Mostly mbox locking/syncing fixes. Still some problems though.
Timo Sirainen <tss@iki.fi>
parents:
492
diff
changeset
|
197 /* Close the box. Returns FALSE if some cleanup errors occured, but |
c834e77b624c
Mostly mbox locking/syncing fixes. Still some problems though.
Timo Sirainen <tss@iki.fi>
parents:
492
diff
changeset
|
198 the mailbox was closed anyway. */ |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
199 int (*close)(struct mailbox *box); |
0 | 200 |
201 /* Gets the mailbox status information. */ | |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
202 int (*get_status)(struct mailbox *box, enum mailbox_status_items items, |
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
203 struct mailbox_status *status); |
0 | 204 |
450
925d6eb5f8be
MailStorage interface change. We now let storage call several sync-functions
Timo Sirainen <tss@iki.fi>
parents:
410
diff
changeset
|
205 /* Synchronize the mailbox. If sync_expunges is FALSE, everything |
925d6eb5f8be
MailStorage interface change. We now let storage call several sync-functions
Timo Sirainen <tss@iki.fi>
parents:
410
diff
changeset
|
206 but expunges are synced. */ |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
207 int (*sync)(struct mailbox *box, int sync_expunges); |
0 | 208 |
450
925d6eb5f8be
MailStorage interface change. We now let storage call several sync-functions
Timo Sirainen <tss@iki.fi>
parents:
410
diff
changeset
|
209 /* Expunge all mails with \Deleted flag. If notify is TRUE, call |
925d6eb5f8be
MailStorage interface change. We now let storage call several sync-functions
Timo Sirainen <tss@iki.fi>
parents:
410
diff
changeset
|
210 expunge callbacks. Also always does full syncing. */ |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
211 int (*expunge)(struct mailbox *box, int notify); |
0 | 212 |
450
925d6eb5f8be
MailStorage interface change. We now let storage call several sync-functions
Timo Sirainen <tss@iki.fi>
parents:
410
diff
changeset
|
213 /* Update mail flags, calling update_flags callbacks. */ |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
214 int (*update_flags)(struct mailbox *box, |
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
215 const char *messageset, int uidset, |
988
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
216 const struct mail_full_flags *flags, |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
217 enum modify_type modify_type, int notify, |
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
218 int *all_found); |
0 | 219 |
450
925d6eb5f8be
MailStorage interface change. We now let storage call several sync-functions
Timo Sirainen <tss@iki.fi>
parents:
410
diff
changeset
|
220 /* Copy mails to another mailbox. */ |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
221 int (*copy)(struct mailbox *box, struct mailbox *destbox, |
0 | 222 const char *messageset, int uidset); |
223 | |
988
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
224 /* Initialize new fetch request. wanted_fields isn't required, but it |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
225 can be used for optimizations. If *update_seen is TRUE, \Seen flag |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
226 is set for all fetched mails. *update_seen may be changed back to |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
227 FALSE if all mails are already seen, or if it's not possible to |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
228 change the flag (eg. read-only mailbox). */ |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
229 struct mail_fetch_context * |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
230 (*fetch_init)(struct mailbox *box, |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
231 enum mail_fetch_field wanted_fields, |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
232 int *update_seen, |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
233 const char *messageset, int uidset); |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
234 /* Deinitialize fetch request. all_found is set to TRUE if all of the |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
235 fetched messages were found (ie. not just deleted). */ |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
236 int (*fetch_deinit)(struct mail_fetch_context *ctx, int *all_found); |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
237 /* Fetch the next message. Returned mail object can be used until |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
238 the next call to fetch_next() or fetch_deinit(). */ |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
239 struct mail *(*fetch_next)(struct mail_fetch_context *ctx); |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
240 |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
241 /* Simplified fetching for a single UID or sequence. Must be called |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
242 between fetch_init() .. fetch_deinit() or |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
243 search_init() .. search_deinit() */ |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
244 struct mail *(*fetch_uid)(struct mailbox *box, unsigned int uid, |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
245 enum mail_fetch_field wanted_fields); |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
246 struct mail *(*fetch_seq)(struct mailbox *box, unsigned int seq, |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
247 enum mail_fetch_field wanted_fields); |
0 | 248 |
988
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
249 /* Modify sort_program to specify a sort program acceptable for |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
250 search_init(). If server supports no sorting, it's simply set to |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
251 {MAIL_SORT_END}. */ |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
252 int (*search_get_sorting)(struct mailbox *box, |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
253 enum mail_sort_type *sort_program); |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
254 /* Initialize new search request. Search arguments are given so that |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
255 the storage can optimize the searching as it wants. |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
256 |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
257 If sort_program is non-NULL, it requests that the returned messages |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
258 are sorted by the given criteria. sort_program must have gone |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
259 through search_get_sorting(). |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
260 |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
261 wanted_fields and wanted_headers aren't required, but they can be |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
262 used for optimizations. */ |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
263 struct mail_search_context * |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
264 (*search_init)(struct mailbox *box, const char *charset, |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
265 struct mail_search_arg *args, |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
266 const enum mail_sort_type *sort_program, |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
267 enum mail_fetch_field wanted_fields, |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
268 const char *const wanted_headers[]); |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
269 /* Deinitialize search request. */ |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
270 int (*search_deinit)(struct mail_search_context *ctx); |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
271 /* Search the next message. Returned mail object can be used until |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
272 the next call to search_next() or search_deinit(). */ |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
273 struct mail *(*search_next)(struct mail_search_context *ctx); |
0 | 274 |
1015
40a327d356de
Support for MULTIAPPEND extension. COPY now behaves like spec says - if it
Timo Sirainen <tss@iki.fi>
parents:
988
diff
changeset
|
275 /* Initialize saving one or more mails. If transaction is TRUE, all |
40a327d356de
Support for MULTIAPPEND extension. COPY now behaves like spec says - if it
Timo Sirainen <tss@iki.fi>
parents:
988
diff
changeset
|
276 the saved mails are deleted if an error occurs or save_deinit() |
40a327d356de
Support for MULTIAPPEND extension. COPY now behaves like spec says - if it
Timo Sirainen <tss@iki.fi>
parents:
988
diff
changeset
|
277 is called with rollback TRUE. */ |
40a327d356de
Support for MULTIAPPEND extension. COPY now behaves like spec says - if it
Timo Sirainen <tss@iki.fi>
parents:
988
diff
changeset
|
278 struct mail_save_context *(*save_init)(struct mailbox *box, |
40a327d356de
Support for MULTIAPPEND extension. COPY now behaves like spec says - if it
Timo Sirainen <tss@iki.fi>
parents:
988
diff
changeset
|
279 int transaction); |
40a327d356de
Support for MULTIAPPEND extension. COPY now behaves like spec says - if it
Timo Sirainen <tss@iki.fi>
parents:
988
diff
changeset
|
280 /* Deinitialize saving. rollback has effect only if save_init() was |
40a327d356de
Support for MULTIAPPEND extension. COPY now behaves like spec says - if it
Timo Sirainen <tss@iki.fi>
parents:
988
diff
changeset
|
281 called with transaction being TRUE. If rollback is FALSE but |
40a327d356de
Support for MULTIAPPEND extension. COPY now behaves like spec says - if it
Timo Sirainen <tss@iki.fi>
parents:
988
diff
changeset
|
282 committing the changes fails, all the commits are rollbacked if |
40a327d356de
Support for MULTIAPPEND extension. COPY now behaves like spec says - if it
Timo Sirainen <tss@iki.fi>
parents:
988
diff
changeset
|
283 possible. */ |
40a327d356de
Support for MULTIAPPEND extension. COPY now behaves like spec says - if it
Timo Sirainen <tss@iki.fi>
parents:
988
diff
changeset
|
284 int (*save_deinit)(struct mail_save_context *ctx, int rollback); |
40a327d356de
Support for MULTIAPPEND extension. COPY now behaves like spec says - if it
Timo Sirainen <tss@iki.fi>
parents:
988
diff
changeset
|
285 /* Save a mail into mailbox. timezone_offset specifies the timezone in |
40a327d356de
Support for MULTIAPPEND extension. COPY now behaves like spec says - if it
Timo Sirainen <tss@iki.fi>
parents:
988
diff
changeset
|
286 minutes in which received_date was originally given with. */ |
40a327d356de
Support for MULTIAPPEND extension. COPY now behaves like spec says - if it
Timo Sirainen <tss@iki.fi>
parents:
988
diff
changeset
|
287 int (*save_next)(struct mail_save_context *ctx, |
40a327d356de
Support for MULTIAPPEND extension. COPY now behaves like spec says - if it
Timo Sirainen <tss@iki.fi>
parents:
988
diff
changeset
|
288 const struct mail_full_flags *flags, |
40a327d356de
Support for MULTIAPPEND extension. COPY now behaves like spec says - if it
Timo Sirainen <tss@iki.fi>
parents:
988
diff
changeset
|
289 time_t received_date, int timezone_offset, |
40a327d356de
Support for MULTIAPPEND extension. COPY now behaves like spec says - if it
Timo Sirainen <tss@iki.fi>
parents:
988
diff
changeset
|
290 struct istream *data); |
0 | 291 |
292 /* Returns TRUE if mailbox is now in inconsistent state, meaning that | |
293 the message IDs etc. may have changed - only way to recover this | |
294 would be to fully close the mailbox and reopen it. With IMAP | |
295 connection this would mean a forced disconnection since we can't | |
296 do forced CLOSE. */ | |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
297 int (*is_inconsistency_error)(struct mailbox *box); |
0 | 298 |
450
925d6eb5f8be
MailStorage interface change. We now let storage call several sync-functions
Timo Sirainen <tss@iki.fi>
parents:
410
diff
changeset
|
299 /* public: */ |
925d6eb5f8be
MailStorage interface change. We now let storage call several sync-functions
Timo Sirainen <tss@iki.fi>
parents:
410
diff
changeset
|
300 unsigned int readonly:1; |
925d6eb5f8be
MailStorage interface change. We now let storage call several sync-functions
Timo Sirainen <tss@iki.fi>
parents:
410
diff
changeset
|
301 unsigned int allow_custom_flags:1; |
0 | 302 /* private: */ |
303 unsigned int inconsistent:1; | |
304 }; | |
305 | |
988
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
306 struct mail { |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
307 /* always set */ |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
308 unsigned int seq; |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
309 unsigned int uid; |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
310 |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
311 unsigned int seen_updated:1; /* if update_seen was TRUE */ |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
312 |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
313 const struct mail_full_flags *(*get_flags)(struct mail *mail); |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
314 const struct message_part *(*get_parts)(struct mail *mail); |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
315 |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
316 /* Get the time message was received (IMAP INTERNALDATE). |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
317 Returns (time_t)-1 if error occured. */ |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
318 time_t (*get_received_date)(struct mail *mail); |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
319 /* Get the Date-header in mail. Timezone is in minutes. |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
320 Returns (time_t)-1 if error occured, 0 if field wasn't found or |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
321 couldn't be parsed. */ |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
322 time_t (*get_date)(struct mail *mail, int *timezone); |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
323 /* Get the full virtual size of mail (IMAP RFC822.SIZE). |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
324 Returns (uoff_t)-1 if error occured */ |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
325 uoff_t (*get_size)(struct mail *mail); |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
326 |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
327 /* Get value for single header field */ |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
328 const char *(*get_header)(struct mail *mail, const char *field); |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
329 |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
330 /* Returns the parsed address for given header field. */ |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
331 const struct message_address *(*get_address)(struct mail *mail, |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
332 const char *field); |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
333 /* Returns the first mailbox (RFC2822 local-part) field for given |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
334 address header field. */ |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
335 const char *(*get_first_mailbox)(struct mail *mail, const char *field); |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
336 |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
337 /* Returns input stream pointing to beginning of message header. |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
338 hdr_size and body_size are updated unless they're NULL. */ |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
339 struct istream *(*get_stream)(struct mail *mail, |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
340 struct message_size *hdr_size, |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
341 struct message_size *body_size); |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
342 |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
343 /* Get the any of the "special" fields. */ |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
344 const char *(*get_special)(struct mail *mail, |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
345 enum mail_fetch_field field); |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
346 }; |
8028c4dcf38f
mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
347 |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
348 struct mailbox_status { |
0 | 349 unsigned int messages; |
350 unsigned int recent; | |
351 unsigned int unseen; | |
352 | |
353 unsigned int uidvalidity; | |
354 unsigned int uidnext; | |
355 | |
356 unsigned int first_unseen_seq; | |
100
867ec80dbf42
Custom flags are now shown in FLAGS and PERMANENTFLAGS lists after SELECT.
Timo Sirainen <tss@iki.fi>
parents:
50
diff
changeset
|
357 |
319
d0cff4da67ac
When selecting a mailbox and we're out of disk space, send ALERT to user
Timo Sirainen <tss@iki.fi>
parents:
296
diff
changeset
|
358 unsigned int diskspace_full:1; |
d0cff4da67ac
When selecting a mailbox and we're out of disk space, send ALERT to user
Timo Sirainen <tss@iki.fi>
parents:
296
diff
changeset
|
359 |
400
f3ab97771ed8
changed all "temporary memory pool" references to "data stack"
Timo Sirainen <tss@iki.fi>
parents:
327
diff
changeset
|
360 /* may be allocated from data stack */ |
450
925d6eb5f8be
MailStorage interface change. We now let storage call several sync-functions
Timo Sirainen <tss@iki.fi>
parents:
410
diff
changeset
|
361 unsigned int custom_flags_count; |
925d6eb5f8be
MailStorage interface change. We now let storage call several sync-functions
Timo Sirainen <tss@iki.fi>
parents:
410
diff
changeset
|
362 const char **custom_flags; |
925d6eb5f8be
MailStorage interface change. We now let storage call several sync-functions
Timo Sirainen <tss@iki.fi>
parents:
410
diff
changeset
|
363 }; |
925d6eb5f8be
MailStorage interface change. We now let storage call several sync-functions
Timo Sirainen <tss@iki.fi>
parents:
410
diff
changeset
|
364 |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
365 struct mail_storage_callbacks { |
450
925d6eb5f8be
MailStorage interface change. We now let storage call several sync-functions
Timo Sirainen <tss@iki.fi>
parents:
410
diff
changeset
|
366 /* Alert: Not enough disk space */ |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
367 void (*alert_no_diskspace)(struct mailbox *mailbox, void *context); |
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
|
368 /* "* OK <text>" */ |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
369 void (*notify_ok)(struct mailbox *mailbox, const char *text, |
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
370 void *context); |
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
|
371 /* "* NO <text>" */ |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
372 void (*notify_no)(struct mailbox *mailbox, const char *text, |
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
373 void *context); |
450
925d6eb5f8be
MailStorage interface change. We now let storage call several sync-functions
Timo Sirainen <tss@iki.fi>
parents:
410
diff
changeset
|
374 |
925d6eb5f8be
MailStorage interface change. We now let storage call several sync-functions
Timo Sirainen <tss@iki.fi>
parents:
410
diff
changeset
|
375 /* EXPUNGE */ |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
376 void (*expunge)(struct mailbox *mailbox, unsigned int seq, |
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
377 void *context); |
450
925d6eb5f8be
MailStorage interface change. We now let storage call several sync-functions
Timo Sirainen <tss@iki.fi>
parents:
410
diff
changeset
|
378 /* FETCH FLAGS */ |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
379 void (*update_flags)(struct mailbox *mailbox, unsigned int seq, |
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
380 unsigned int uid, enum mail_flags flags, |
450
925d6eb5f8be
MailStorage interface change. We now let storage call several sync-functions
Timo Sirainen <tss@iki.fi>
parents:
410
diff
changeset
|
381 const char *custom_flags[], |
925d6eb5f8be
MailStorage interface change. We now let storage call several sync-functions
Timo Sirainen <tss@iki.fi>
parents:
410
diff
changeset
|
382 unsigned int custom_flags_count, void *context); |
925d6eb5f8be
MailStorage interface change. We now let storage call several sync-functions
Timo Sirainen <tss@iki.fi>
parents:
410
diff
changeset
|
383 |
925d6eb5f8be
MailStorage interface change. We now let storage call several sync-functions
Timo Sirainen <tss@iki.fi>
parents:
410
diff
changeset
|
384 /* EXISTS, RECENT */ |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
385 void (*new_messages)(struct mailbox *mailbox, |
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
386 unsigned int messages_count, |
450
925d6eb5f8be
MailStorage interface change. We now let storage call several sync-functions
Timo Sirainen <tss@iki.fi>
parents:
410
diff
changeset
|
387 unsigned int recent_count, void *context); |
925d6eb5f8be
MailStorage interface change. We now let storage call several sync-functions
Timo Sirainen <tss@iki.fi>
parents:
410
diff
changeset
|
388 /* FLAGS, PERMANENTFLAGS */ |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
389 void (*new_custom_flags)(struct mailbox *mailbox, |
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
390 const char *custom_flags[], |
450
925d6eb5f8be
MailStorage interface change. We now let storage call several sync-functions
Timo Sirainen <tss@iki.fi>
parents:
410
diff
changeset
|
391 unsigned int custom_flags_count, |
925d6eb5f8be
MailStorage interface change. We now let storage call several sync-functions
Timo Sirainen <tss@iki.fi>
parents:
410
diff
changeset
|
392 void *context); |
925d6eb5f8be
MailStorage interface change. We now let storage call several sync-functions
Timo Sirainen <tss@iki.fi>
parents:
410
diff
changeset
|
393 |
0 | 394 }; |
395 | |
1138
340dea0150bf
Added client_workarounds setting, with currently one workaround for OE6.
Timo Sirainen <tss@iki.fi>
parents:
1038
diff
changeset
|
396 extern enum client_workarounds client_workarounds; |
1151
058f6c26f405
Added mail_full_filesystem_access setting. Some of the setting variable
Timo Sirainen <tss@iki.fi>
parents:
1138
diff
changeset
|
397 extern int full_filesystem_access; |
1138
340dea0150bf
Added client_workarounds setting, with currently one workaround for OE6.
Timo Sirainen <tss@iki.fi>
parents:
1038
diff
changeset
|
398 |
340dea0150bf
Added client_workarounds setting, with currently one workaround for OE6.
Timo Sirainen <tss@iki.fi>
parents:
1038
diff
changeset
|
399 /* Initialize mail storage. */ |
340dea0150bf
Added client_workarounds setting, with currently one workaround for OE6.
Timo Sirainen <tss@iki.fi>
parents:
1038
diff
changeset
|
400 void mail_storage_init(void); |
340dea0150bf
Added client_workarounds setting, with currently one workaround for OE6.
Timo Sirainen <tss@iki.fi>
parents:
1038
diff
changeset
|
401 |
0 | 402 /* register all mail storages */ |
403 void mail_storage_register_all(void); | |
404 | |
405 /* Register mail storage class with given name - all methods that are NULL | |
406 are set to default methods */ | |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
407 void mail_storage_class_register(struct mail_storage *storage_class); |
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
408 void mail_storage_class_unregister(struct mail_storage *storage_class); |
0 | 409 |
410 /* Create a new instance of registered mail storage class with given | |
411 storage-specific data. If data is NULL, it tries to use defaults. | |
412 May return NULL if anything fails. */ | |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
413 struct mail_storage *mail_storage_create(const char *name, const char *data, |
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
414 const char *user); |
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
415 void mail_storage_destroy(struct mail_storage *storage); |
0 | 416 |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
417 struct mail_storage *mail_storage_create_default(const char *user); |
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
418 struct mail_storage *mail_storage_create_with_data(const char *data, |
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
419 const char *user); |
0 | 420 |
13
bb294faf7379
"Critical errors" aren't displayed to users anymore, ie. anything that is
Timo Sirainen <tss@iki.fi>
parents:
10
diff
changeset
|
421 /* Set error message in storage. Critical errors are logged with i_error(), |
bb294faf7379
"Critical errors" aren't displayed to users anymore, ie. anything that is
Timo Sirainen <tss@iki.fi>
parents:
10
diff
changeset
|
422 but user sees only "internal error" message. */ |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
423 void mail_storage_clear_error(struct mail_storage *storage); |
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
424 void mail_storage_set_error(struct mail_storage *storage, |
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
425 const char *fmt, ...) __attr_format__(2, 3); |
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
426 void mail_storage_set_syntax_error(struct mail_storage *storage, |
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
427 const char *fmt, ...) __attr_format__(2, 3); |
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
428 void mail_storage_set_critical(struct mail_storage *storage, |
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
429 const char *fmt, ...) __attr_format__(2, 3); |
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
430 void mail_storage_set_internal_error(struct mail_storage *storage); |
0 | 431 |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
432 const char *mail_storage_get_last_error(struct mail_storage *storage, |
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
433 int *syntax); |
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
889
diff
changeset
|
434 int mail_storage_is_inconsistency_error(struct mailbox *box); |
0 | 435 |
436 #endif |