annotate src/lib-storage/mail-storage-private.h @ 5500:4862cb37106c HEAD

Moved namespace handling to lib-storage. Beginnings of namespace support for non-IMAP parts of Dovecot.
author Timo Sirainen <tss@iki.fi>
date Tue, 03 Apr 2007 11:34:27 +0300
parents 8e58322ef87e
children 24b751bc0995
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
1 #ifndef __MAIL_STORAGE_PRIVATE_H
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
2 #define __MAIL_STORAGE_PRIVATE_H
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
3
5450
7a6db5ec047d Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents: 5448
diff changeset
4 #include "module-context.h"
4876
f1d77064884c Lock handling changes. Everything goes through file-lock API now and there's
Timo Sirainen <tss@iki.fi>
parents: 4853
diff changeset
5 #include "file-lock.h"
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
6 #include "mail-storage.h"
5450
7a6db5ec047d Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents: 5448
diff changeset
7 #include "mail-index-private.h"
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
8
4848
967de900c73a Mailbox list indexing and related changes. Currently works only with
Timo Sirainen <tss@iki.fi>
parents: 4822
diff changeset
9 /* Called after mail storage has been created */
967de900c73a Mailbox list indexing and related changes. Currently works only with
Timo Sirainen <tss@iki.fi>
parents: 4822
diff changeset
10 extern void (*hook_mail_storage_created)(struct mail_storage *storage);
4489
3d2be769d887 Added hook_mailbox_opened to make it easier to hook all mailbox opens.
Timo Sirainen <tss@iki.fi>
parents: 4455
diff changeset
11 /* Called after mailbox has been opened */
3d2be769d887 Added hook_mailbox_opened to make it easier to hook all mailbox opens.
Timo Sirainen <tss@iki.fi>
parents: 4455
diff changeset
12 extern void (*hook_mailbox_opened)(struct mailbox *box);
3d2be769d887 Added hook_mailbox_opened to make it easier to hook all mailbox opens.
Timo Sirainen <tss@iki.fi>
parents: 4455
diff changeset
13
5450
7a6db5ec047d Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents: 5448
diff changeset
14 struct mail_storage_module_register {
7a6db5ec047d Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents: 5448
diff changeset
15 unsigned int id;
7a6db5ec047d Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents: 5448
diff changeset
16 };
7a6db5ec047d Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents: 5448
diff changeset
17
7a6db5ec047d Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents: 5448
diff changeset
18 struct mail_module_register {
7a6db5ec047d Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents: 5448
diff changeset
19 unsigned int id;
7a6db5ec047d Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents: 5448
diff changeset
20 };
7a6db5ec047d Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents: 5448
diff changeset
21
4453
85fcdb478608 Beginnings of joining mail-storage API more closely to mail-index, so that
Timo Sirainen <timo.sirainen@movial.fi>
parents: 4451
diff changeset
22 struct mail_storage_vfuncs {
85fcdb478608 Beginnings of joining mail-storage API more closely to mail-index, so that
Timo Sirainen <timo.sirainen@movial.fi>
parents: 4451
diff changeset
23 void (*class_init)(void);
85fcdb478608 Beginnings of joining mail-storage API more closely to mail-index, so that
Timo Sirainen <timo.sirainen@movial.fi>
parents: 4451
diff changeset
24 void (*class_deinit)(void);
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
25
5460
105e0cd21036 Added virtual mail_storage.alloc() function and changed create() to work
Timo Sirainen <tss@iki.fi>
parents: 5459
diff changeset
26 struct mail_storage *(*alloc)(void);
5461
08b42ced91a6 Removed mail_storage_create_with_data(). mail_storage_create() with
Timo Sirainen <tss@iki.fi>
parents: 5460
diff changeset
27 int (*create)(struct mail_storage *storage, const char *data);
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
28 void (*destroy)(struct mail_storage *storage);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
29
3863
55df57c028d4 Added "bool" type and changed all ints that were used as booleans to bool.
Timo Sirainen <tss@iki.fi>
parents: 3735
diff changeset
30 bool (*autodetect)(const char *data, enum mail_storage_flags flags);
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
31
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
32 struct mailbox *(*mailbox_open)(struct mail_storage *storage,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
33 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
34 struct istream *input,
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
35 enum mailbox_open_flags flags);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
36
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
37 int (*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: 3735
diff changeset
38 bool directory);
3209
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
39 };
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
40
5450
7a6db5ec047d Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents: 5448
diff changeset
41 union mail_storage_module_context {
7a6db5ec047d Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents: 5448
diff changeset
42 struct mail_storage_vfuncs super;
7a6db5ec047d Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents: 5448
diff changeset
43 struct mail_storage_module_register *reg;
7a6db5ec047d Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents: 5448
diff changeset
44 };
7a6db5ec047d Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents: 5448
diff changeset
45
3209
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
46 struct mail_storage {
4822
4b54fc2cb12a const fix
Timo Sirainen <tss@iki.fi>
parents: 4808
diff changeset
47 const char *name;
4808
93bc9770f938 Initial code for separation of mailbox accessing and directory layout
Timo Sirainen <tss@iki.fi>
parents: 4607
diff changeset
48 bool mailbox_is_file;
3209
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
49
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
50 struct mail_storage_vfuncs v;
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
51
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
52 /* private: */
3209
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
53 pool_t pool;
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
54
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
55 char *error;
5500
4862cb37106c Moved namespace handling to lib-storage. Beginnings of namespace support for
Timo Sirainen <tss@iki.fi>
parents: 5468
diff changeset
56 struct mail_namespace *ns;
4808
93bc9770f938 Initial code for separation of mailbox accessing and directory layout
Timo Sirainen <tss@iki.fi>
parents: 4607
diff changeset
57 struct mailbox_list *list;
5459
78eaf595359c Removed struct index_storage abstraction. It's pointless.
Timo Sirainen <tss@iki.fi>
parents: 5450
diff changeset
58
78eaf595359c Removed struct index_storage abstraction. It's pointless.
Timo Sirainen <tss@iki.fi>
parents: 5450
diff changeset
59 const char *user; /* name of user accessing the storage */
3033
146897976cfa Added mail_debug setting. Moved full_filesystem_access from global variable
Timo Sirainen <tss@iki.fi>
parents: 3016
diff changeset
60 enum mail_storage_flags flags;
4876
f1d77064884c Lock handling changes. Everything goes through file-lock API now and there's
Timo Sirainen <tss@iki.fi>
parents: 4853
diff changeset
61 enum file_lock_method lock_method;
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
62
4949
a959d4208b54 Moved storage callbacks to struct mail_storage. If searching takes over 10
Timo Sirainen <tss@iki.fi>
parents: 4939
diff changeset
63 struct mail_storage_callbacks *callbacks;
a959d4208b54 Moved storage callbacks to struct mail_storage. If searching takes over 10
Timo Sirainen <tss@iki.fi>
parents: 4939
diff changeset
64 void *callback_context;
a959d4208b54 Moved storage callbacks to struct mail_storage. If searching takes over 10
Timo Sirainen <tss@iki.fi>
parents: 4939
diff changeset
65
3209
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
66 /* Module-specific contexts. See mail_storage_module_id. */
5450
7a6db5ec047d Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents: 5448
diff changeset
67 ARRAY_DEFINE(module_contexts, union mail_storage_module_context *);
3209
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
68
3517
46bfbbcc3c54 Added separate "temporary error" flag for mail_storage_get_last_error().
Timo Sirainen <tss@iki.fi>
parents: 3260
diff changeset
69 /* IMAP: Give a BAD reply instead of NO */
46bfbbcc3c54 Added separate "temporary error" flag for mail_storage_get_last_error().
Timo Sirainen <tss@iki.fi>
parents: 3260
diff changeset
70 unsigned int syntax_error:1;
46bfbbcc3c54 Added separate "temporary error" flag for mail_storage_get_last_error().
Timo Sirainen <tss@iki.fi>
parents: 3260
diff changeset
71 /* Internal temporary error, as opposed to visible user errors like
46bfbbcc3c54 Added separate "temporary error" flag for mail_storage_get_last_error().
Timo Sirainen <tss@iki.fi>
parents: 3260
diff changeset
72 "permission denied" or "out of disk space" */
46bfbbcc3c54 Added separate "temporary error" flag for mail_storage_get_last_error().
Timo Sirainen <tss@iki.fi>
parents: 3260
diff changeset
73 unsigned int temporary_error:1;
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
74 };
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
75
3209
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
76 struct mailbox_vfuncs {
3863
55df57c028d4 Added "bool" type and changed all ints that were used as booleans to bool.
Timo Sirainen <tss@iki.fi>
parents: 3735
diff changeset
77 bool (*is_readonly)(struct mailbox *box);
55df57c028d4 Added "bool" type and changed all ints that were used as booleans to bool.
Timo Sirainen <tss@iki.fi>
parents: 3735
diff changeset
78 bool (*allow_new_keywords)(struct mailbox *box);
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
79
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
80 int (*close)(struct mailbox *box);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
81
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
82 int (*get_status)(struct mailbox *box, enum mailbox_status_items items,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
83 struct mailbox_status *status);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
84
2322
aae574ed7f4c Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents: 2225
diff changeset
85 struct mailbox_sync_context *
aae574ed7f4c Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents: 2225
diff changeset
86 (*sync_init)(struct mailbox *box,
aae574ed7f4c Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents: 2225
diff changeset
87 enum mailbox_sync_flags flags);
aae574ed7f4c Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents: 2225
diff changeset
88 int (*sync_next)(struct mailbox_sync_context *ctx,
aae574ed7f4c Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents: 2225
diff changeset
89 struct mailbox_sync_rec *sync_rec_r);
aae574ed7f4c Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents: 2225
diff changeset
90 int (*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: 4822
diff changeset
91 enum mailbox_status_items status_items,
2322
aae574ed7f4c Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents: 2225
diff changeset
92 struct mailbox_status *status_r);
aae574ed7f4c Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents: 2225
diff changeset
93
5465
014236cf3dcc Moved notify settings to struct mailbox. Removed the parameters from
Timo Sirainen <tss@iki.fi>
parents: 5462
diff changeset
94 void (*notify_changes)(struct mailbox *box);
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
95
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
96 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: 3138
diff changeset
97 (*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: 3138
diff changeset
98 enum mailbox_transaction_flags flags);
2518
f8be7a5e273a Added sync flags parameter to mailbox_transaction_commit(), so EXPUNGE can
Timo Sirainen <tss@iki.fi>
parents: 2446
diff changeset
99 int (*transaction_commit)(struct mailbox_transaction_context *t,
f8be7a5e273a Added sync flags parameter to mailbox_transaction_commit(), so EXPUNGE can
Timo Sirainen <tss@iki.fi>
parents: 2446
diff changeset
100 enum mailbox_sync_flags flags);
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
101 void (*transaction_rollback)(struct mailbox_transaction_context *t);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
102
3016
61c8d205d887 Initial support for keywords. Syncing to mbox/maildir doesn't work yet.
Timo Sirainen <tss@iki.fi>
parents: 2518
diff changeset
103 struct mail_keywords *
61c8d205d887 Initial support for keywords. Syncing to mbox/maildir doesn't work yet.
Timo Sirainen <tss@iki.fi>
parents: 2518
diff changeset
104 (*keywords_create)(struct mailbox_transaction_context *t,
61c8d205d887 Initial support for keywords. Syncing to mbox/maildir doesn't work yet.
Timo Sirainen <tss@iki.fi>
parents: 2518
diff changeset
105 const char *const keywords[]);
3138
fbe844061fe2 Internal changes in how keywords are handled. struct mail_keywords isn't
Timo Sirainen <tss@iki.fi>
parents: 3086
diff changeset
106 void (*keywords_free)(struct mailbox_transaction_context *t,
fbe844061fe2 Internal changes in how keywords are handled. struct mail_keywords isn't
Timo Sirainen <tss@iki.fi>
parents: 3086
diff changeset
107 struct mail_keywords *keywords);
3016
61c8d205d887 Initial support for keywords. Syncing to mbox/maildir doesn't work yet.
Timo Sirainen <tss@iki.fi>
parents: 2518
diff changeset
108
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
109 int (*get_uids)(struct mailbox *box, uint32_t uid1, uint32_t uid2,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
110 uint32_t *seq1_r, uint32_t *seq2_r);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
111
3209
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
112 struct mail *
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
113 (*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: 3138
diff changeset
114 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: 3138
diff changeset
115 struct mailbox_header_lookup_ctx *wanted_headers);
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
116
2327
7d02e2a7672d Header caching redesigned. New design allows caching decisions per field, so
Timo Sirainen <tss@iki.fi>
parents: 2322
diff changeset
117 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
118 (*header_lookup_init)(struct mailbox *box,
7d02e2a7672d Header caching redesigned. New design allows caching decisions per field, so
Timo Sirainen <tss@iki.fi>
parents: 2322
diff changeset
119 const char *const headers[]);
7d02e2a7672d Header caching redesigned. New design allows caching decisions per field, so
Timo Sirainen <tss@iki.fi>
parents: 2322
diff changeset
120 void (*header_lookup_deinit)(struct mailbox_header_lookup_ctx *ctx);
7d02e2a7672d Header caching redesigned. New design allows caching decisions per field, so
Timo Sirainen <tss@iki.fi>
parents: 2322
diff changeset
121
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
122 struct mail_search_context *
2327
7d02e2a7672d Header caching redesigned. New design allows caching decisions per field, so
Timo Sirainen <tss@iki.fi>
parents: 2322
diff changeset
123 (*search_init)(struct mailbox_transaction_context *t,
7d02e2a7672d Header caching redesigned. New design allows caching decisions per field, so
Timo Sirainen <tss@iki.fi>
parents: 2322
diff changeset
124 const char *charset, struct mail_search_arg *args,
3209
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
125 const enum mail_sort_type *sort_program);
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
126 int (*search_deinit)(struct mail_search_context *ctx);
4939
ff2272c228cc Dovecot is now able to execute multiple commands at the same time.
Timo Sirainen <tss@iki.fi>
parents: 4876
diff changeset
127 int (*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: 4876
diff changeset
128 struct mail *mail, bool *tryagain_r);
4196
6ac0d63b297f Optimized searching a bit for cases where we can restrict search range by
Timo Sirainen <tss@iki.fi>
parents: 4076
diff changeset
129 /* Internal search function which updates ctx->seq */
6ac0d63b297f Optimized searching a bit for cases where we can restrict search range by
Timo Sirainen <tss@iki.fi>
parents: 4076
diff changeset
130 int (*search_next_update_seq)(struct mail_search_context *ctx);
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
131
4044
da1d65e064f8 mailbox_save_init() supports now returning failure. Quota plugin now checks
Timo Sirainen <timo.sirainen@movial.fi>
parents: 4041
diff changeset
132 int (*save_init)(struct mailbox_transaction_context *t,
da1d65e064f8 mailbox_save_init() supports now returning failure. Quota plugin now checks
Timo Sirainen <timo.sirainen@movial.fi>
parents: 4041
diff changeset
133 enum mail_flags flags,
da1d65e064f8 mailbox_save_init() supports now returning failure. Quota plugin now checks
Timo Sirainen <timo.sirainen@movial.fi>
parents: 4041
diff changeset
134 struct mail_keywords *keywords,
da1d65e064f8 mailbox_save_init() supports now returning failure. Quota plugin now checks
Timo Sirainen <timo.sirainen@movial.fi>
parents: 4041
diff changeset
135 time_t received_date, int timezone_offset,
da1d65e064f8 mailbox_save_init() supports now returning failure. Quota plugin now checks
Timo Sirainen <timo.sirainen@movial.fi>
parents: 4041
diff changeset
136 const char *from_envelope, struct istream *input,
4268
7112aad504ae Changed mailbox_save_*() API a bit: Moved the struct mail *dest_mail to
Timo Sirainen <timo.sirainen@movial.fi>
parents: 4196
diff changeset
137 struct mail *dest_mail,
7112aad504ae Changed mailbox_save_*() API a bit: Moved the struct mail *dest_mail to
Timo Sirainen <timo.sirainen@movial.fi>
parents: 4196
diff changeset
138 struct mail_save_context **ctx_r);
2446
47e1e05cede0 Changed mail saving API to be nonblocking.
Timo Sirainen <tss@iki.fi>
parents: 2350
diff changeset
139 int (*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: 4196
diff changeset
140 int (*save_finish)(struct mail_save_context *ctx);
2446
47e1e05cede0 Changed mail saving API to be nonblocking.
Timo Sirainen <tss@iki.fi>
parents: 2350
diff changeset
141 void (*save_cancel)(struct mail_save_context *ctx);
47e1e05cede0 Changed mail saving API to be nonblocking.
Timo Sirainen <tss@iki.fi>
parents: 2350
diff changeset
142
2190
755ec9442a58 mailbox_save() and mailbox_copy() functions can now return the saved mail so
Timo Sirainen <tss@iki.fi>
parents: 1958
diff changeset
143 int (*copy)(struct mailbox_transaction_context *t, struct mail *mail,
3641
3de464cb604f Added flags and keywords parameters to mailbox_copy() in case they're wanted
Timo Sirainen <tss@iki.fi>
parents: 3517
diff changeset
144 enum mail_flags flags, struct mail_keywords *keywords,
3209
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
145 struct mail *dest_mail);
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
146
3863
55df57c028d4 Added "bool" type and changed all ints that were used as booleans to bool.
Timo Sirainen <tss@iki.fi>
parents: 3735
diff changeset
147 bool (*is_inconsistent)(struct mailbox *box);
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
148 };
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
149
5450
7a6db5ec047d Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents: 5448
diff changeset
150 union mailbox_module_context {
7a6db5ec047d Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents: 5448
diff changeset
151 struct mailbox_vfuncs super;
7a6db5ec047d Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents: 5448
diff changeset
152 struct mail_storage_module_register *reg;
7a6db5ec047d Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents: 5448
diff changeset
153 };
7a6db5ec047d Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents: 5448
diff changeset
154
3209
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
155 struct mailbox {
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
156 char *name;
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
157 struct mail_storage *storage;
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
158
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
159 struct mailbox_vfuncs v;
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
160 /* private: */
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
161 pool_t pool;
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
162
4939
ff2272c228cc Dovecot is now able to execute multiple commands at the same time.
Timo Sirainen <tss@iki.fi>
parents: 4876
diff changeset
163 unsigned int transaction_count;
ff2272c228cc Dovecot is now able to execute multiple commands at the same time.
Timo Sirainen <tss@iki.fi>
parents: 4876
diff changeset
164
5465
014236cf3dcc Moved notify settings to struct mailbox. Removed the parameters from
Timo Sirainen <tss@iki.fi>
parents: 5462
diff changeset
165 /* Mailbox notification settings: */
014236cf3dcc Moved notify settings to struct mailbox. Removed the parameters from
Timo Sirainen <tss@iki.fi>
parents: 5462
diff changeset
166 unsigned int notify_min_interval;
014236cf3dcc Moved notify settings to struct mailbox. Removed the parameters from
Timo Sirainen <tss@iki.fi>
parents: 5462
diff changeset
167 mailbox_notify_callback_t *notify_callback;
014236cf3dcc Moved notify settings to struct mailbox. Removed the parameters from
Timo Sirainen <tss@iki.fi>
parents: 5462
diff changeset
168 void *notify_context;
014236cf3dcc Moved notify settings to struct mailbox. Removed the parameters from
Timo Sirainen <tss@iki.fi>
parents: 5462
diff changeset
169
3209
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
170 /* Module-specific contexts. See mail_storage_module_id. */
5450
7a6db5ec047d Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents: 5448
diff changeset
171 ARRAY_DEFINE(module_contexts, union mailbox_module_context *);
4848
967de900c73a Mailbox list indexing and related changes. Currently works only with
Timo Sirainen <tss@iki.fi>
parents: 4822
diff changeset
172
967de900c73a Mailbox list indexing and related changes. Currently works only with
Timo Sirainen <tss@iki.fi>
parents: 4822
diff changeset
173 /* When FAST open flag is used, the mailbox isn't actually opened until
967de900c73a Mailbox list indexing and related changes. Currently works only with
Timo Sirainen <tss@iki.fi>
parents: 4822
diff changeset
174 it's synced for the first time. */
967de900c73a Mailbox list indexing and related changes. Currently works only with
Timo Sirainen <tss@iki.fi>
parents: 4822
diff changeset
175 unsigned int opened:1;
3209
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
176 };
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
177
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
178 struct mail_vfuncs {
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
179 void (*free)(struct mail *mail);
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
180 int (*set_seq)(struct mail *mail, uint32_t seq);
4274
bd519db7f6e5 Added mail_set_uid() to select a mail by UID.
Timo Sirainen <timo.sirainen@movial.fi>
parents: 4268
diff changeset
181 int (*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: 3138
diff changeset
182
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
183 enum mail_flags (*get_flags)(struct mail *mail);
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
184 const char *const *(*get_keywords)(struct mail *mail);
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
185 const struct message_part *(*get_parts)(struct mail *mail);
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
186
4455
fce5140fbe0b Added mail_get_save_date() and some cleanups.
Timo Sirainen <timo.sirainen@movial.fi>
parents: 4453
diff changeset
187 time_t (*get_date)(struct mail *mail, int *timezone);
3209
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
188 time_t (*get_received_date)(struct mail *mail);
4455
fce5140fbe0b Added mail_get_save_date() and some cleanups.
Timo Sirainen <timo.sirainen@movial.fi>
parents: 4453
diff changeset
189 time_t (*get_save_date)(struct mail *mail);
3209
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
190 uoff_t (*get_virtual_size)(struct mail *mail);
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
191 uoff_t (*get_physical_size)(struct mail *mail);
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
192
3248
ff47e78ad717 Renamed mail_get_header() to mail_get_first_header() and mail_gets_headers()
Timo Sirainen <tss@iki.fi>
parents: 3245
diff changeset
193 const char *(*get_first_header)(struct mail *mail, const char *field);
ff47e78ad717 Renamed mail_get_header() to mail_get_first_header() and mail_gets_headers()
Timo Sirainen <tss@iki.fi>
parents: 3245
diff changeset
194 const char *const *(*get_headers)(struct mail *mail, const char *field);
3209
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
195 struct istream *
3248
ff47e78ad717 Renamed mail_get_header() to mail_get_first_header() and mail_gets_headers()
Timo Sirainen <tss@iki.fi>
parents: 3245
diff changeset
196 (*get_header_stream)(struct mail *mail,
ff47e78ad717 Renamed mail_get_header() to mail_get_first_header() and mail_gets_headers()
Timo Sirainen <tss@iki.fi>
parents: 3245
diff changeset
197 struct mailbox_header_lookup_ctx *headers);
3209
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
198 struct istream *(*get_stream)(struct mail *mail,
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
199 struct message_size *hdr_size,
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
200 struct message_size *body_size);
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
201
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
202 const char *(*get_special)(struct mail *mail,
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
203 enum mail_fetch_field field);
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
204
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
205 int (*update_flags)(struct mail *mail, enum modify_type modify_type,
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
206 enum mail_flags flags);
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
207 int (*update_keywords)(struct mail *mail, enum modify_type modify_type,
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
208 struct mail_keywords *keywords);
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
209
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
210 int (*expunge)(struct mail *mail);
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
211 };
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
212
5450
7a6db5ec047d Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents: 5448
diff changeset
213 union mail_module_context {
7a6db5ec047d Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents: 5448
diff changeset
214 struct mail_vfuncs super;
7a6db5ec047d Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents: 5448
diff changeset
215 struct mail_module_register *reg;
7a6db5ec047d Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents: 5448
diff changeset
216 };
7a6db5ec047d Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents: 5448
diff changeset
217
3209
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
218 struct mail_private {
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
219 struct mail mail;
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
220 struct mail_vfuncs v;
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
221
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
222 pool_t pool;
5450
7a6db5ec047d Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents: 5448
diff changeset
223 ARRAY_DEFINE(module_contexts, union mail_module_context *);
3209
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
224 };
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
225
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
226 struct mailbox_list_context {
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
227 struct mail_storage *storage;
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
228 enum mailbox_list_flags flags;
4041
9d7420b0e1ef Make life easier for plugins:
Timo Sirainen <timo.sirainen@movial.fi>
parents: 3863
diff changeset
229 bool failed;
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
230 };
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
231
5450
7a6db5ec047d Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents: 5448
diff changeset
232 union mailbox_transaction_module_context {
7a6db5ec047d Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents: 5448
diff changeset
233 struct mail_storage_module_register *reg;
7a6db5ec047d Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents: 5448
diff changeset
234 };
7a6db5ec047d Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents: 5448
diff changeset
235
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
236 struct mailbox_transaction_context {
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
237 struct mailbox *box;
5450
7a6db5ec047d Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents: 5448
diff changeset
238 ARRAY_DEFINE(module_contexts,
7a6db5ec047d Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents: 5448
diff changeset
239 union mailbox_transaction_module_context *);
7a6db5ec047d Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents: 5448
diff changeset
240 };
7a6db5ec047d Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents: 5448
diff changeset
241
7a6db5ec047d Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents: 5448
diff changeset
242 union mail_search_module_context {
7a6db5ec047d Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents: 5448
diff changeset
243 struct mail_storage_module_register *reg;
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
244 };
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
245
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
246 struct mail_search_context {
3209
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
247 struct mailbox_transaction_context *transaction;
4607
71b3570946f8 Moved some search parameters to public struct mail_search_context and added
Timo Sirainen <tss@iki.fi>
parents: 4606
diff changeset
248
71b3570946f8 Moved some search parameters to public struct mail_search_context and added
Timo Sirainen <tss@iki.fi>
parents: 4606
diff changeset
249 char *charset;
71b3570946f8 Moved some search parameters to public struct mail_search_context and added
Timo Sirainen <tss@iki.fi>
parents: 4606
diff changeset
250 struct mail_search_arg *args;
71b3570946f8 Moved some search parameters to public struct mail_search_context and added
Timo Sirainen <tss@iki.fi>
parents: 4606
diff changeset
251 struct mail_search_sort_program *sort_program;
71b3570946f8 Moved some search parameters to public struct mail_search_context and added
Timo Sirainen <tss@iki.fi>
parents: 4606
diff changeset
252
4196
6ac0d63b297f Optimized searching a bit for cases where we can restrict search range by
Timo Sirainen <tss@iki.fi>
parents: 4076
diff changeset
253 uint32_t seq;
5450
7a6db5ec047d Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents: 5448
diff changeset
254 ARRAY_DEFINE(module_contexts, union mail_search_module_context *);
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
255 };
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
256
2446
47e1e05cede0 Changed mail saving API to be nonblocking.
Timo Sirainen <tss@iki.fi>
parents: 2350
diff changeset
257 struct mail_save_context {
3209
923ff19873d4 Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
258 struct mailbox_transaction_context *transaction;
4268
7112aad504ae Changed mailbox_save_*() API a bit: Moved the struct mail *dest_mail to
Timo Sirainen <timo.sirainen@movial.fi>
parents: 4196
diff changeset
259 struct mail *dest_mail;
2446
47e1e05cede0 Changed mail saving API to be nonblocking.
Timo Sirainen <tss@iki.fi>
parents: 2350
diff changeset
260 };
47e1e05cede0 Changed mail saving API to be nonblocking.
Timo Sirainen <tss@iki.fi>
parents: 2350
diff changeset
261
2322
aae574ed7f4c Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents: 2225
diff changeset
262 struct mailbox_sync_context {
aae574ed7f4c Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents: 2225
diff changeset
263 struct mailbox *box;
aae574ed7f4c Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents: 2225
diff changeset
264 };
aae574ed7f4c Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents: 2225
diff changeset
265
2327
7d02e2a7672d Header caching redesigned. New design allows caching decisions per field, so
Timo Sirainen <tss@iki.fi>
parents: 2322
diff changeset
266 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
267 struct mailbox *box;
7d02e2a7672d Header caching redesigned. New design allows caching decisions per field, so
Timo Sirainen <tss@iki.fi>
parents: 2322
diff changeset
268 };
7d02e2a7672d Header caching redesigned. New design allows caching decisions per field, so
Timo Sirainen <tss@iki.fi>
parents: 2322
diff changeset
269
4453
85fcdb478608 Beginnings of joining mail-storage API more closely to mail-index, so that
Timo Sirainen <timo.sirainen@movial.fi>
parents: 4451
diff changeset
270 /* Modules should use do "my_id = mail_storage_module_id++" and
85fcdb478608 Beginnings of joining mail-storage API more closely to mail-index, so that
Timo Sirainen <timo.sirainen@movial.fi>
parents: 4451
diff changeset
271 use objects' module_contexts[id] for their own purposes. */
5450
7a6db5ec047d Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents: 5448
diff changeset
272 extern struct mail_storage_module_register mail_storage_module_register;
4453
85fcdb478608 Beginnings of joining mail-storage API more closely to mail-index, so that
Timo Sirainen <timo.sirainen@movial.fi>
parents: 4451
diff changeset
273
85fcdb478608 Beginnings of joining mail-storage API more closely to mail-index, so that
Timo Sirainen <timo.sirainen@movial.fi>
parents: 4451
diff changeset
274 /* Storage's module_id for mail_index. */
5450
7a6db5ec047d Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents: 5448
diff changeset
275 extern struct mail_module_register mail_module_register;
4453
85fcdb478608 Beginnings of joining mail-storage API more closely to mail-index, so that
Timo Sirainen <timo.sirainen@movial.fi>
parents: 4451
diff changeset
276
5450
7a6db5ec047d Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents: 5448
diff changeset
277 #define MAIL_STORAGE_CONTEXT(obj) \
7a6db5ec047d Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents: 5448
diff changeset
278 MODULE_CONTEXT(obj, mail_storage_mail_index_module)
7a6db5ec047d Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents: 5448
diff changeset
279 extern MODULE_CONTEXT_DEFINE(mail_storage_mail_index_module,
7a6db5ec047d Better type safety to module_contexts arrays. Already fixed some bugs.
Timo Sirainen <tss@iki.fi>
parents: 5448
diff changeset
280 &mail_index_module_register);
4453
85fcdb478608 Beginnings of joining mail-storage API more closely to mail-index, so that
Timo Sirainen <timo.sirainen@movial.fi>
parents: 4451
diff changeset
281
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
282 /* Set error message in storage. Critical errors are logged with i_error(),
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
283 but user sees only "internal error" message. */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
284 void mail_storage_clear_error(struct mail_storage *storage);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
285 void mail_storage_set_error(struct mail_storage *storage,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
286 const char *fmt, ...) __attr_format__(2, 3);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
287 void mail_storage_set_syntax_error(struct mail_storage *storage,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
288 const char *fmt, ...) __attr_format__(2, 3);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
289 void mail_storage_set_critical(struct mail_storage *storage,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
290 const char *fmt, ...) __attr_format__(2, 3);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
291 void mail_storage_set_internal_error(struct mail_storage *storage);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
292
2225
5947497c3e40 get_last_error() wasn't virtualizable
Timo Sirainen <tss@iki.fi>
parents: 2190
diff changeset
293 const char *mail_storage_class_get_last_error(struct mail_storage *storage,
3863
55df57c028d4 Added "bool" type and changed all ints that were used as booleans to bool.
Timo Sirainen <tss@iki.fi>
parents: 3735
diff changeset
294 bool *syntax_error_r);
4808
93bc9770f938 Initial code for separation of mailbox accessing and directory layout
Timo Sirainen <tss@iki.fi>
parents: 4607
diff changeset
295
93bc9770f938 Initial code for separation of mailbox accessing and directory layout
Timo Sirainen <tss@iki.fi>
parents: 4607
diff changeset
296 enum mailbox_list_flags
93bc9770f938 Initial code for separation of mailbox accessing and directory layout
Timo Sirainen <tss@iki.fi>
parents: 4607
diff changeset
297 mail_storage_get_list_flags(enum mail_storage_flags storage_flags);
5448
beabd433cdae Moved delete/rename operations to mailbox_list API. Fixed mbox/maildir to
Timo Sirainen <tss@iki.fi>
parents: 4949
diff changeset
298 bool mail_storage_errno2str(const char **error_r);
2225
5947497c3e40 get_last_error() wasn't virtualizable
Timo Sirainen <tss@iki.fi>
parents: 2190
diff changeset
299
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
300 #endif