Mercurial > dovecot > core-2.2
annotate src/lib-storage/mail-storage-private.h @ 3517:46bfbbcc3c54 HEAD
Added separate "temporary error" flag for mail_storage_get_last_error().
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Fri, 29 Jul 2005 11:43:04 +0300 |
parents | 6a179bf1272e |
children | 3de464cb604f |
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 |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
4 #include "mail-storage.h" |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
5 |
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
|
6 /* Modules should use do "my_id = mail_storage_module_id++" and |
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
|
7 use objects' module_contexts[id] for their own purposes. */ |
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
|
8 extern unsigned int mail_storage_module_id; |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
9 |
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
|
10 struct mail_storage_vfuncs { |
3260
6a179bf1272e
Moved several getenv()s from lib-storage to main code. deliver binary was
Timo Sirainen <tss@iki.fi>
parents:
3248
diff
changeset
|
11 struct mail_storage * |
6a179bf1272e
Moved several getenv()s from lib-storage to main code. deliver binary was
Timo Sirainen <tss@iki.fi>
parents:
3248
diff
changeset
|
12 (*create)(const char *data, const char *user, |
6a179bf1272e
Moved several getenv()s from lib-storage to main code. deliver binary was
Timo Sirainen <tss@iki.fi>
parents:
3248
diff
changeset
|
13 enum mail_storage_flags flags, |
6a179bf1272e
Moved several getenv()s from lib-storage to main code. deliver binary was
Timo Sirainen <tss@iki.fi>
parents:
3248
diff
changeset
|
14 enum mail_storage_lock_method lock_method); |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
15 void (*destroy)(struct mail_storage *storage); |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
16 |
3033
146897976cfa
Added mail_debug setting. Moved full_filesystem_access from global variable
Timo Sirainen <tss@iki.fi>
parents:
3016
diff
changeset
|
17 int (*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
|
18 |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
19 void (*set_callbacks)(struct mail_storage *storage, |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
20 struct mail_storage_callbacks *callbacks, |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
21 void *context); |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
22 |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
23 struct mailbox *(*mailbox_open)(struct mail_storage *storage, |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
24 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
|
25 struct istream *input, |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
26 enum mailbox_open_flags flags); |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
27 |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
28 int (*mailbox_create)(struct mail_storage *storage, const char *name, |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
29 int directory); |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
30 int (*mailbox_delete)(struct mail_storage *storage, const char *name); |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
31 int (*mailbox_rename)(struct mail_storage *storage, const char *oldname, |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
32 const char *newname); |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
33 |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
34 struct mailbox_list_context * |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
35 (*mailbox_list_init)(struct mail_storage *storage, |
2350
1371d41c375f
Moved namespace and hierarchy separator handling to imap-specific code. LIST
Timo Sirainen <tss@iki.fi>
parents:
2327
diff
changeset
|
36 const char *ref, const char *mask, |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
37 enum mailbox_list_flags flags); |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
38 struct mailbox_list * |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
39 (*mailbox_list_next)(struct mailbox_list_context *ctx); |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
40 int (*mailbox_list_deinit)(struct mailbox_list_context *ctx); |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
41 |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
42 int (*set_subscribed)(struct mail_storage *storage, |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
43 const char *name, int set); |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
44 |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
45 int (*get_mailbox_name_status)(struct mail_storage *storage, |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
46 const char *name, |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
47 enum mailbox_name_status *status); |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
48 |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
49 const char *(*get_last_error)(struct mail_storage *storage, |
3517
46bfbbcc3c54
Added separate "temporary error" flag for mail_storage_get_last_error().
Timo Sirainen <tss@iki.fi>
parents:
3260
diff
changeset
|
50 int *syntax_error_r, |
46bfbbcc3c54
Added separate "temporary error" flag for mail_storage_get_last_error().
Timo Sirainen <tss@iki.fi>
parents:
3260
diff
changeset
|
51 int *temporary_error_r); |
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
|
52 }; |
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 |
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 struct mail_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
|
55 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
|
56 char hierarchy_sep; |
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
|
57 |
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
|
58 struct mail_storage_vfuncs v; |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
59 |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
60 /* 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
|
61 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
|
62 |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
63 char *error; |
3033
146897976cfa
Added mail_debug setting. Moved full_filesystem_access from global variable
Timo Sirainen <tss@iki.fi>
parents:
3016
diff
changeset
|
64 enum mail_storage_flags flags; |
3260
6a179bf1272e
Moved several getenv()s from lib-storage to main code. deliver binary was
Timo Sirainen <tss@iki.fi>
parents:
3248
diff
changeset
|
65 enum mail_storage_lock_method lock_method; |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
66 |
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
|
67 /* Module-specific contexts. See mail_storage_module_id. */ |
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 array_t ARRAY_DEFINE(module_contexts, void); |
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
|
69 |
3517
46bfbbcc3c54
Added separate "temporary error" flag for mail_storage_get_last_error().
Timo Sirainen <tss@iki.fi>
parents:
3260
diff
changeset
|
70 /* 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
|
71 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
|
72 /* 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
|
73 "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
|
74 unsigned int temporary_error:1; |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
75 }; |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
76 |
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
|
77 struct mailbox_vfuncs { |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
78 int (*is_readonly)(struct mailbox *box); |
1958 | 79 int (*allow_new_keywords)(struct mailbox *box); |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
80 |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
81 int (*close)(struct mailbox *box); |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
82 |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
83 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
|
84 struct mailbox_status *status); |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
85 |
2322
aae574ed7f4c
Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents:
2225
diff
changeset
|
86 struct mailbox_sync_context * |
aae574ed7f4c
Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents:
2225
diff
changeset
|
87 (*sync_init)(struct mailbox *box, |
aae574ed7f4c
Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents:
2225
diff
changeset
|
88 enum mailbox_sync_flags flags); |
aae574ed7f4c
Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents:
2225
diff
changeset
|
89 int (*sync_next)(struct mailbox_sync_context *ctx, |
aae574ed7f4c
Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents:
2225
diff
changeset
|
90 struct mailbox_sync_rec *sync_rec_r); |
aae574ed7f4c
Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents:
2225
diff
changeset
|
91 int (*sync_deinit)(struct mailbox_sync_context *ctx, |
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 |
aae574ed7f4c
Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents:
2225
diff
changeset
|
94 void (*notify_changes)(struct mailbox *box, unsigned int min_interval, |
aae574ed7f4c
Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents:
2225
diff
changeset
|
95 mailbox_notify_callback_t *callback, |
aae574ed7f4c
Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents:
2225
diff
changeset
|
96 void *context); |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
97 |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
98 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
|
99 (*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
|
100 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
|
101 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
|
102 enum mailbox_sync_flags flags); |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
103 void (*transaction_rollback)(struct mailbox_transaction_context *t); |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
104 |
3016
61c8d205d887
Initial support for keywords. Syncing to mbox/maildir doesn't work yet.
Timo Sirainen <tss@iki.fi>
parents:
2518
diff
changeset
|
105 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
|
106 (*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
|
107 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
|
108 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
|
109 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
|
110 |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
111 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
|
112 uint32_t *seq1_r, uint32_t *seq2_r); |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
113 |
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
|
114 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
|
115 (*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
|
116 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
|
117 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
|
118 |
2327
7d02e2a7672d
Header caching redesigned. New design allows caching decisions per field, so
Timo Sirainen <tss@iki.fi>
parents:
2322
diff
changeset
|
119 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
|
120 (*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
|
121 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
|
122 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
|
123 |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
124 int (*search_get_sorting)(struct mailbox *box, |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
125 enum mail_sort_type *sort_program); |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
126 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
|
127 (*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
|
128 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
|
129 const enum mail_sort_type *sort_program); |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
130 int (*search_deinit)(struct mail_search_context *ctx); |
3209
923ff19873d4
Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents:
3138
diff
changeset
|
131 int (*search_next)(struct mail_search_context *ctx, struct mail *mail); |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
132 |
2446
47e1e05cede0
Changed mail saving API to be nonblocking.
Timo Sirainen <tss@iki.fi>
parents:
2350
diff
changeset
|
133 struct mail_save_context * |
47e1e05cede0
Changed mail saving API to be nonblocking.
Timo Sirainen <tss@iki.fi>
parents:
2350
diff
changeset
|
134 (*save_init)(struct mailbox_transaction_context *t, |
3016
61c8d205d887
Initial support for keywords. Syncing to mbox/maildir doesn't work yet.
Timo Sirainen <tss@iki.fi>
parents:
2518
diff
changeset
|
135 enum mail_flags flags, |
3086 | 136 struct mail_keywords *keywords, |
2446
47e1e05cede0
Changed mail saving API to be nonblocking.
Timo Sirainen <tss@iki.fi>
parents:
2350
diff
changeset
|
137 time_t received_date, int timezone_offset, |
47e1e05cede0
Changed mail saving API to be nonblocking.
Timo Sirainen <tss@iki.fi>
parents:
2350
diff
changeset
|
138 const char *from_envelope, struct istream *input, |
47e1e05cede0
Changed mail saving API to be nonblocking.
Timo Sirainen <tss@iki.fi>
parents:
2350
diff
changeset
|
139 int want_mail); |
47e1e05cede0
Changed mail saving API to be nonblocking.
Timo Sirainen <tss@iki.fi>
parents:
2350
diff
changeset
|
140 int (*save_continue)(struct mail_save_context *ctx); |
3209
923ff19873d4
Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents:
3138
diff
changeset
|
141 int (*save_finish)(struct mail_save_context *ctx, |
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
|
142 struct mail *dest_mail); |
2446
47e1e05cede0
Changed mail saving API to be nonblocking.
Timo Sirainen <tss@iki.fi>
parents:
2350
diff
changeset
|
143 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
|
144 |
2190
755ec9442a58
mailbox_save() and mailbox_copy() functions can now return the saved mail so
Timo Sirainen <tss@iki.fi>
parents:
1958
diff
changeset
|
145 int (*copy)(struct mailbox_transaction_context *t, 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
|
146 struct mail *dest_mail); |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
147 |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
148 int (*is_inconsistent)(struct mailbox *box); |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
149 }; |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
150 |
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
|
151 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
|
152 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
|
153 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
|
154 |
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_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
|
156 /* 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
|
157 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
|
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 /* Module-specific contexts. See mail_storage_module_id. */ |
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 array_t ARRAY_DEFINE(module_contexts, void); |
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 }; |
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 |
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
|
163 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
|
164 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
|
165 int (*set_seq)(struct mail *mail, uint32_t seq); |
923ff19873d4
Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents:
3138
diff
changeset
|
166 |
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
|
167 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
|
168 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
|
169 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
|
170 |
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
|
171 time_t (*get_received_date)(struct mail *mail); |
923ff19873d4
Major mail-storage API changes. It's now a bit cleaner and much more plugin
Timo Sirainen <tss@iki.fi>
parents:
3138
diff
changeset
|
172 time_t (*get_date)(struct mail *mail, int *timezone); |
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
|
173 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
|
174 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
|
175 |
3248
ff47e78ad717
Renamed mail_get_header() to mail_get_first_header() and mail_gets_headers()
Timo Sirainen <tss@iki.fi>
parents:
3245
diff
changeset
|
176 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
|
177 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
|
178 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
|
179 (*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
|
180 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
|
181 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
|
182 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
|
183 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
|
184 |
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 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
|
186 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
|
187 |
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 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
|
189 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
|
190 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
|
191 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
|
192 |
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
|
193 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
|
194 }; |
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 |
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
|
196 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
|
197 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
|
198 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
|
199 |
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 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
|
201 array_t ARRAY_DEFINE(module_contexts, void); |
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 }; |
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 |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
204 struct mailbox_list_context { |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
205 struct mail_storage *storage; |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
206 }; |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
207 |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
208 struct mailbox_transaction_context { |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
209 struct mailbox *box; |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
210 }; |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
211 |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
212 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
|
213 struct mailbox_transaction_context *transaction; |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
214 }; |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
215 |
2446
47e1e05cede0
Changed mail saving API to be nonblocking.
Timo Sirainen <tss@iki.fi>
parents:
2350
diff
changeset
|
216 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
|
217 struct mailbox_transaction_context *transaction; |
2446
47e1e05cede0
Changed mail saving API to be nonblocking.
Timo Sirainen <tss@iki.fi>
parents:
2350
diff
changeset
|
218 }; |
47e1e05cede0
Changed mail saving API to be nonblocking.
Timo Sirainen <tss@iki.fi>
parents:
2350
diff
changeset
|
219 |
2322
aae574ed7f4c
Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents:
2225
diff
changeset
|
220 struct mailbox_sync_context { |
aae574ed7f4c
Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents:
2225
diff
changeset
|
221 struct mailbox *box; |
aae574ed7f4c
Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents:
2225
diff
changeset
|
222 }; |
aae574ed7f4c
Broke mailbox_sync() into iterator.
Timo Sirainen <tss@iki.fi>
parents:
2225
diff
changeset
|
223 |
2327
7d02e2a7672d
Header caching redesigned. New design allows caching decisions per field, so
Timo Sirainen <tss@iki.fi>
parents:
2322
diff
changeset
|
224 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
|
225 struct mailbox *box; |
7d02e2a7672d
Header caching redesigned. New design allows caching decisions per field, so
Timo Sirainen <tss@iki.fi>
parents:
2322
diff
changeset
|
226 }; |
7d02e2a7672d
Header caching redesigned. New design allows caching decisions per field, so
Timo Sirainen <tss@iki.fi>
parents:
2322
diff
changeset
|
227 |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
228 /* 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
|
229 but user sees only "internal error" message. */ |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
230 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
|
231 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
|
232 const char *fmt, ...) __attr_format__(2, 3); |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
233 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
|
234 const char *fmt, ...) __attr_format__(2, 3); |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
235 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
|
236 const char *fmt, ...) __attr_format__(2, 3); |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
237 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
|
238 |
2225
5947497c3e40
get_last_error() wasn't virtualizable
Timo Sirainen <tss@iki.fi>
parents:
2190
diff
changeset
|
239 const char *mail_storage_class_get_last_error(struct mail_storage *storage, |
5947497c3e40
get_last_error() wasn't virtualizable
Timo Sirainen <tss@iki.fi>
parents:
2190
diff
changeset
|
240 int *syntax_error_r); |
5947497c3e40
get_last_error() wasn't virtualizable
Timo Sirainen <tss@iki.fi>
parents:
2190
diff
changeset
|
241 |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
242 #endif |