Mercurial > dovecot > core-2.2
annotate src/imap/imap-client.h @ 18707:e0a17714f0c9
imap: Added %{deleted}, %{expunged} and %{trashed} to imap_logout_format
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Fri, 15 May 2015 14:55:21 +0300 |
parents | 93bba97afb2a |
children | 64c73e6bd397 |
rev | line source |
---|---|
9219
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
1 #ifndef IMAP_CLIENT_H |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
2 #define IMAP_CLIENT_H |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
3 |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
4 #include "imap-commands.h" |
13563
690f60827f59
imap: Moved partial fetch cache from static variable into struct client.
Timo Sirainen <tss@iki.fi>
parents:
12755
diff
changeset
|
5 #include "message-size.h" |
9219
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
6 |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
7 #define CLIENT_COMMAND_QUEUE_MAX_SIZE 4 |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
8 /* Maximum number of CONTEXT=SEARCH UPDATEs. Clients probably won't need more |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
9 than a few, so this is mainly to avoid more or less accidental pointless |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
10 resource usage. */ |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
11 #define CLIENT_MAX_SEARCH_UPDATES 10 |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
12 |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
13 struct client; |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
14 struct mail_storage; |
17841
576da94fd669
imap, pop3: Show user's proper log prefix when deinitializing users at exit.
Timo Sirainen <tss@iki.fi>
parents:
17070
diff
changeset
|
15 struct mail_storage_service_ctx; |
9219
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
16 struct imap_parser; |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
17 struct imap_arg; |
15066
d419aac7ab31
Added support for IMAP URLAUTH and URLAUTH=BINARY extensions
Stephan Bosch <stephan@rename-it.nl>
parents:
14971
diff
changeset
|
18 struct imap_urlauth_context; |
9219
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
19 |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
20 struct mailbox_keywords { |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
21 /* All keyword names. The array itself exists in mail_index. |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
22 Keywords are currently only appended, they're never removed. */ |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
23 const ARRAY_TYPE(keywords) *names; |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
24 /* Number of keywords announced to client via FLAGS/PERMANENTFLAGS. |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
25 This relies on keywords not being removed while mailbox is |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
26 selected. */ |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
27 unsigned int announce_count; |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
28 }; |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
29 |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
30 struct imap_search_update { |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
31 char *tag; |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
32 struct mail_search_result *result; |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
33 bool return_uids; |
14899
f9d0ea98157f
imap: Implemented NOTIFY extension.
Timo Sirainen <tss@iki.fi>
parents:
14682
diff
changeset
|
34 |
f9d0ea98157f
imap: Implemented NOTIFY extension.
Timo Sirainen <tss@iki.fi>
parents:
14682
diff
changeset
|
35 pool_t fetch_pool; |
f9d0ea98157f
imap: Implemented NOTIFY extension.
Timo Sirainen <tss@iki.fi>
parents:
14682
diff
changeset
|
36 struct imap_fetch_context *fetch_ctx; |
9219
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
37 }; |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
38 |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
39 enum client_command_state { |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
40 /* Waiting for more input */ |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
41 CLIENT_COMMAND_STATE_WAIT_INPUT, |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
42 /* Waiting to be able to send more output */ |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
43 CLIENT_COMMAND_STATE_WAIT_OUTPUT, |
15066
d419aac7ab31
Added support for IMAP URLAUTH and URLAUTH=BINARY extensions
Stephan Bosch <stephan@rename-it.nl>
parents:
14971
diff
changeset
|
44 /* Waiting for external interaction */ |
d419aac7ab31
Added support for IMAP URLAUTH and URLAUTH=BINARY extensions
Stephan Bosch <stephan@rename-it.nl>
parents:
14971
diff
changeset
|
45 CLIENT_COMMAND_STATE_WAIT_EXTERNAL, |
9219
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
46 /* Wait for other commands to finish execution */ |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
47 CLIENT_COMMAND_STATE_WAIT_UNAMBIGUITY, |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
48 /* Waiting for other commands to finish so we can sync */ |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
49 CLIENT_COMMAND_STATE_WAIT_SYNC, |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
50 /* Command is finished */ |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
51 CLIENT_COMMAND_STATE_DONE |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
52 }; |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
53 |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
54 struct client_command_context { |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
55 struct client_command_context *prev, *next; |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
56 struct client *client; |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
57 |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
58 pool_t pool; |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
59 /* IMAP command tag */ |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
60 const char *tag; |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
61 /* Name of this command */ |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
62 const char *name; |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
63 /* Parameters for this command. These are generated from parsed IMAP |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
64 arguments, so they may not be exactly the same as how client sent |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
65 them. */ |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
66 const char *args; |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
67 enum command_flags cmd_flags; |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
68 |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
69 command_func_t *func; |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
70 void *context; |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
71 |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
72 /* Module-specific contexts. */ |
14920
a097ef0a9d6d
Array API changed: ARRAY_DEFINE(name, type) -> ARRAY(type) name
Timo Sirainen <tss@iki.fi>
parents:
14899
diff
changeset
|
73 ARRAY(union imap_module_context *) module_contexts; |
9219
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
74 |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
75 struct imap_parser *parser; |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
76 enum client_command_state state; |
18432
abf2727d469a
imap: Include in tagged reply how much running time each IMAP command takes.
Timo Sirainen <tss@iki.fi>
parents:
17841
diff
changeset
|
77 /* time when command handling was started - typically this is after |
abf2727d469a
imap: Include in tagged reply how much running time each IMAP command takes.
Timo Sirainen <tss@iki.fi>
parents:
17841
diff
changeset
|
78 reading all the parameters. */ |
abf2727d469a
imap: Include in tagged reply how much running time each IMAP command takes.
Timo Sirainen <tss@iki.fi>
parents:
17841
diff
changeset
|
79 struct timeval start_time; |
abf2727d469a
imap: Include in tagged reply how much running time each IMAP command takes.
Timo Sirainen <tss@iki.fi>
parents:
17841
diff
changeset
|
80 /* time when an unfinished command handling entered back to ioloop. |
abf2727d469a
imap: Include in tagged reply how much running time each IMAP command takes.
Timo Sirainen <tss@iki.fi>
parents:
17841
diff
changeset
|
81 used for calculating usecs_in_ioloop */ |
abf2727d469a
imap: Include in tagged reply how much running time each IMAP command takes.
Timo Sirainen <tss@iki.fi>
parents:
17841
diff
changeset
|
82 struct timeval last_ioloop_time; |
abf2727d469a
imap: Include in tagged reply how much running time each IMAP command takes.
Timo Sirainen <tss@iki.fi>
parents:
17841
diff
changeset
|
83 /* how much time was spent waiting for the client in ioloop */ |
abf2727d469a
imap: Include in tagged reply how much running time each IMAP command takes.
Timo Sirainen <tss@iki.fi>
parents:
17841
diff
changeset
|
84 uint64_t usecs_in_ioloop; |
9219
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
85 |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
86 struct client_sync_context *sync; |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
87 |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
88 unsigned int uid:1; /* used UID command */ |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
89 unsigned int cancel:1; /* command is wanted to be cancelled */ |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
90 unsigned int param_error:1; |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
91 unsigned int search_save_result:1; /* search result is being updated */ |
12751
3053befe6a64
imap: Fixed infinite loop / memory eating with SEARCHRES + pipelining $.
Timo Sirainen <tss@iki.fi>
parents:
12496
diff
changeset
|
92 unsigned int search_save_result_used:1; /* command uses search save */ |
9219
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
93 unsigned int temp_executed:1; /* temporary execution state tracking */ |
14971
075dcb7eac58
imap: Added asserts to make sure a tagline isn't sent twice to the same command.
Timo Sirainen <tss@iki.fi>
parents:
14942
diff
changeset
|
94 unsigned int tagline_sent:1; |
9219
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
95 }; |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
96 |
14219
e20af99c6d20
imap: Made client_destroy() a virtual method.
Timo Sirainen <tss@iki.fi>
parents:
13563
diff
changeset
|
97 struct imap_client_vfuncs { |
e20af99c6d20
imap: Made client_destroy() a virtual method.
Timo Sirainen <tss@iki.fi>
parents:
13563
diff
changeset
|
98 void (*destroy)(struct client *client, const char *reason); |
e20af99c6d20
imap: Made client_destroy() a virtual method.
Timo Sirainen <tss@iki.fi>
parents:
13563
diff
changeset
|
99 }; |
e20af99c6d20
imap: Made client_destroy() a virtual method.
Timo Sirainen <tss@iki.fi>
parents:
13563
diff
changeset
|
100 |
9219
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
101 struct client { |
9355
d6d4ec8ac06d
imap, pop3 no longer assume that there's only a single client in process.
Timo Sirainen <tss@iki.fi>
parents:
9235
diff
changeset
|
102 struct client *prev, *next; |
d6d4ec8ac06d
imap, pop3 no longer assume that there's only a single client in process.
Timo Sirainen <tss@iki.fi>
parents:
9235
diff
changeset
|
103 |
14219
e20af99c6d20
imap: Made client_destroy() a virtual method.
Timo Sirainen <tss@iki.fi>
parents:
13563
diff
changeset
|
104 struct imap_client_vfuncs v; |
14302
5bbcf636bbeb
Added a "session ID" string for imap/pop3 connections, available in %{session} variable.
Timo Sirainen <tss@iki.fi>
parents:
13563
diff
changeset
|
105 const char *session_id; |
14219
e20af99c6d20
imap: Made client_destroy() a virtual method.
Timo Sirainen <tss@iki.fi>
parents:
13563
diff
changeset
|
106 |
9219
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
107 int fd_in, fd_out; |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
108 struct io *io; |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
109 struct istream *input; |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
110 struct ostream *output; |
15066
d419aac7ab31
Added support for IMAP URLAUTH and URLAUTH=BINARY extensions
Stephan Bosch <stephan@rename-it.nl>
parents:
14971
diff
changeset
|
111 struct timeout *to_idle, *to_idle_output, *to_delayed_input; |
9219
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
112 |
10696
57814e99b451
imap: Added module_contexts to struct client.
Timo Sirainen <tss@iki.fi>
parents:
10695
diff
changeset
|
113 pool_t pool; |
10130
d1384c2b08e5
Merged single and multi mail_storage_service_*() functions.
Timo Sirainen <tss@iki.fi>
parents:
10101
diff
changeset
|
114 struct mail_storage_service_user *service_user; |
9219
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
115 const struct imap_settings *set; |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
116 string_t *capability_string; |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
117 |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
118 struct mail_user *user; |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
119 struct mailbox *mailbox; |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
120 struct mailbox_keywords keywords; |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
121 unsigned int sync_counter; |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
122 uint32_t messages_count, recent_count, uidvalidity; |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
123 enum mailbox_feature enabled_features; |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
124 |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
125 time_t last_input, last_output; |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
126 unsigned int bad_counter; |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
127 |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
128 /* one parser is kept here to be used for new commands */ |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
129 struct imap_parser *free_parser; |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
130 /* command_pool is cleared when the command queue gets empty */ |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
131 pool_t command_pool; |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
132 /* New commands are always prepended to the queue */ |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
133 struct client_command_context *command_queue; |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
134 unsigned int command_queue_size; |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
135 |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
136 uint64_t sync_last_full_modseq; |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
137 uint64_t highest_fetch_modseq; |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
138 |
18706
93bba97afb2a
Added %{fetch_hdr/body_count/bytes} variables to imap_logout_format
Timo Sirainen <tss@iki.fi>
parents:
18432
diff
changeset
|
139 /* For imap_logout_format statistics: */ |
93bba97afb2a
Added %{fetch_hdr/body_count/bytes} variables to imap_logout_format
Timo Sirainen <tss@iki.fi>
parents:
18432
diff
changeset
|
140 unsigned int fetch_hdr_count, fetch_body_count; |
93bba97afb2a
Added %{fetch_hdr/body_count/bytes} variables to imap_logout_format
Timo Sirainen <tss@iki.fi>
parents:
18432
diff
changeset
|
141 uint64_t fetch_hdr_bytes, fetch_body_bytes; |
18707
e0a17714f0c9
imap: Added %{deleted}, %{expunged} and %{trashed} to imap_logout_format
Timo Sirainen <tss@iki.fi>
parents:
18706
diff
changeset
|
142 unsigned int deleted_count, expunged_count, trashed_count; |
18706
93bba97afb2a
Added %{fetch_hdr/body_count/bytes} variables to imap_logout_format
Timo Sirainen <tss@iki.fi>
parents:
18432
diff
changeset
|
143 |
9219
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
144 /* SEARCHRES extension: Last saved SEARCH result */ |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
145 ARRAY_TYPE(seq_range) search_saved_uidset; |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
146 /* SEARCH=CONTEXT extension: Searches that get updated */ |
14920
a097ef0a9d6d
Array API changed: ARRAY_DEFINE(name, type) -> ARRAY(type) name
Timo Sirainen <tss@iki.fi>
parents:
14899
diff
changeset
|
147 ARRAY(struct imap_search_update) search_updates; |
14899
f9d0ea98157f
imap: Implemented NOTIFY extension.
Timo Sirainen <tss@iki.fi>
parents:
14682
diff
changeset
|
148 /* NOTIFY extension */ |
f9d0ea98157f
imap: Implemented NOTIFY extension.
Timo Sirainen <tss@iki.fi>
parents:
14682
diff
changeset
|
149 struct imap_notify_context *notify_ctx; |
f9d0ea98157f
imap: Implemented NOTIFY extension.
Timo Sirainen <tss@iki.fi>
parents:
14682
diff
changeset
|
150 uint32_t notify_uidnext; |
9219
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
151 |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
152 /* client input/output is locked by this command */ |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
153 struct client_command_context *input_lock; |
14899
f9d0ea98157f
imap: Implemented NOTIFY extension.
Timo Sirainen <tss@iki.fi>
parents:
14682
diff
changeset
|
154 struct client_command_context *output_cmd_lock; |
9219
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
155 /* command changing the mailbox */ |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
156 struct client_command_context *mailbox_change_lock; |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
157 |
15066
d419aac7ab31
Added support for IMAP URLAUTH and URLAUTH=BINARY extensions
Stephan Bosch <stephan@rename-it.nl>
parents:
14971
diff
changeset
|
158 /* IMAP URLAUTH context (RFC4467) */ |
d419aac7ab31
Added support for IMAP URLAUTH and URLAUTH=BINARY extensions
Stephan Bosch <stephan@rename-it.nl>
parents:
14971
diff
changeset
|
159 struct imap_urlauth_context *urlauth_ctx; |
d419aac7ab31
Added support for IMAP URLAUTH and URLAUTH=BINARY extensions
Stephan Bosch <stephan@rename-it.nl>
parents:
14971
diff
changeset
|
160 |
10696
57814e99b451
imap: Added module_contexts to struct client.
Timo Sirainen <tss@iki.fi>
parents:
10695
diff
changeset
|
161 /* Module-specific contexts. */ |
14920
a097ef0a9d6d
Array API changed: ARRAY_DEFINE(name, type) -> ARRAY(type) name
Timo Sirainen <tss@iki.fi>
parents:
14899
diff
changeset
|
162 ARRAY(union imap_module_context *) module_contexts; |
10696
57814e99b451
imap: Added module_contexts to struct client.
Timo Sirainen <tss@iki.fi>
parents:
10695
diff
changeset
|
163 |
9219
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
164 /* syncing marks this TRUE when it sees \Deleted flags. this is by |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
165 EXPUNGE for Outlook-workaround. */ |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
166 unsigned int sync_seen_deletes:1; |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
167 unsigned int disconnected:1; |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
168 unsigned int destroyed:1; |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
169 unsigned int handling_input:1; |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
170 unsigned int syncing:1; |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
171 unsigned int id_logged:1; |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
172 unsigned int mailbox_examined:1; |
9235
2e2b957f1cca
Implemented anvil service, which is used to implement mail_max_userip_connections.
Timo Sirainen <tss@iki.fi>
parents:
9219
diff
changeset
|
173 unsigned int anvil_sent:1; |
10695
fd5141e85076
imap: Remember if TLS compression is enabled.
Timo Sirainen <tss@iki.fi>
parents:
10661
diff
changeset
|
174 unsigned int tls_compression:1; |
9219
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
175 unsigned int input_skip_line:1; /* skip all the data until we've |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
176 found a new line */ |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
177 unsigned int modseqs_sent_since_sync:1; |
14899
f9d0ea98157f
imap: Implemented NOTIFY extension.
Timo Sirainen <tss@iki.fi>
parents:
14682
diff
changeset
|
178 unsigned int notify_immediate_expunges:1; |
f9d0ea98157f
imap: Implemented NOTIFY extension.
Timo Sirainen <tss@iki.fi>
parents:
14682
diff
changeset
|
179 unsigned int notify_count_changes:1; |
f9d0ea98157f
imap: Implemented NOTIFY extension.
Timo Sirainen <tss@iki.fi>
parents:
14682
diff
changeset
|
180 unsigned int notify_flag_changes:1; |
16916
0a08efeb3f40
imap: Added initial support for METADATA extension.
Timo Sirainen <tss@iki.fi>
parents:
15178
diff
changeset
|
181 unsigned int imap_metadata_enabled:1; |
17070
f5e51a926542
imap: if mailbox has non-permanent modseqs, never send HIGHESTMODSEQ/MODSEQs.
Timo Sirainen <tss@iki.fi>
parents:
16916
diff
changeset
|
182 unsigned int nonpermanent_modseqs:1; |
9219
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
183 }; |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
184 |
14219
e20af99c6d20
imap: Made client_destroy() a virtual method.
Timo Sirainen <tss@iki.fi>
parents:
13563
diff
changeset
|
185 struct imap_module_register { |
e20af99c6d20
imap: Made client_destroy() a virtual method.
Timo Sirainen <tss@iki.fi>
parents:
13563
diff
changeset
|
186 unsigned int id; |
e20af99c6d20
imap: Made client_destroy() a virtual method.
Timo Sirainen <tss@iki.fi>
parents:
13563
diff
changeset
|
187 }; |
e20af99c6d20
imap: Made client_destroy() a virtual method.
Timo Sirainen <tss@iki.fi>
parents:
13563
diff
changeset
|
188 |
e20af99c6d20
imap: Made client_destroy() a virtual method.
Timo Sirainen <tss@iki.fi>
parents:
13563
diff
changeset
|
189 union imap_module_context { |
e20af99c6d20
imap: Made client_destroy() a virtual method.
Timo Sirainen <tss@iki.fi>
parents:
13563
diff
changeset
|
190 struct imap_client_vfuncs super; |
e20af99c6d20
imap: Made client_destroy() a virtual method.
Timo Sirainen <tss@iki.fi>
parents:
13563
diff
changeset
|
191 struct imap_module_register *reg; |
e20af99c6d20
imap: Made client_destroy() a virtual method.
Timo Sirainen <tss@iki.fi>
parents:
13563
diff
changeset
|
192 }; |
e20af99c6d20
imap: Made client_destroy() a virtual method.
Timo Sirainen <tss@iki.fi>
parents:
13563
diff
changeset
|
193 extern struct imap_module_register imap_module_register; |
e20af99c6d20
imap: Made client_destroy() a virtual method.
Timo Sirainen <tss@iki.fi>
parents:
13563
diff
changeset
|
194 |
10101
4fe8c4382712
Redesigned how login process passes connections to mail processes and changed related APIs.
Timo Sirainen <tss@iki.fi>
parents:
10093
diff
changeset
|
195 extern struct client *imap_clients; |
10192
585bceaf98bb
imap: Added support for verbose_proctitle=yes
Timo Sirainen <tss@iki.fi>
parents:
10130
diff
changeset
|
196 extern unsigned int imap_client_count; |
10101
4fe8c4382712
Redesigned how login process passes connections to mail processes and changed related APIs.
Timo Sirainen <tss@iki.fi>
parents:
10093
diff
changeset
|
197 |
9219
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
198 /* Create new client with specified input/output handles. socket specifies |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
199 if the handle is a socket. */ |
14302
5bbcf636bbeb
Added a "session ID" string for imap/pop3 connections, available in %{session} variable.
Timo Sirainen <tss@iki.fi>
parents:
13563
diff
changeset
|
200 struct client *client_create(int fd_in, int fd_out, const char *session_id, |
5bbcf636bbeb
Added a "session ID" string for imap/pop3 connections, available in %{session} variable.
Timo Sirainen <tss@iki.fi>
parents:
13563
diff
changeset
|
201 struct mail_user *user, |
10130
d1384c2b08e5
Merged single and multi mail_storage_service_*() functions.
Timo Sirainen <tss@iki.fi>
parents:
10101
diff
changeset
|
202 struct mail_storage_service_user *service_user, |
9219
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
203 const struct imap_settings *set); |
14629
c93ca5e46a8a
Marked functions parameters that are allowed to be NULL. Some APIs were also changed.
Timo Sirainen <tss@iki.fi>
parents:
14623
diff
changeset
|
204 void client_destroy(struct client *client, const char *reason) ATTR_NULL(2); |
9219
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
205 |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
206 /* Disconnect client connection */ |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
207 void client_disconnect(struct client *client, const char *reason); |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
208 void client_disconnect_with_error(struct client *client, const char *msg); |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
209 |
14682
d0d7b810646b
Make sure we check all the functions' return values. Minor API changes to simplify this.
Timo Sirainen <tss@iki.fi>
parents:
14629
diff
changeset
|
210 /* Send a line of data to client. */ |
d0d7b810646b
Make sure we check all the functions' return values. Minor API changes to simplify this.
Timo Sirainen <tss@iki.fi>
parents:
14629
diff
changeset
|
211 void client_send_line(struct client *client, const char *data); |
9219
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
212 /* Send a line of data to client. Returns 1 if ok, 0 if buffer is getting full, |
14682
d0d7b810646b
Make sure we check all the functions' return values. Minor API changes to simplify this.
Timo Sirainen <tss@iki.fi>
parents:
14629
diff
changeset
|
213 -1 if error. This should be used when you're (potentially) sending a lot of |
d0d7b810646b
Make sure we check all the functions' return values. Minor API changes to simplify this.
Timo Sirainen <tss@iki.fi>
parents:
14629
diff
changeset
|
214 lines to client. */ |
d0d7b810646b
Make sure we check all the functions' return values. Minor API changes to simplify this.
Timo Sirainen <tss@iki.fi>
parents:
14629
diff
changeset
|
215 int client_send_line_next(struct client *client, const char *data); |
10661
bd06d9b159fa
imap-client.h: Updated comments.
Timo Sirainen <tss@iki.fi>
parents:
10192
diff
changeset
|
216 /* Send line of data to client, prefixed with client->tag. You need to prefix |
bd06d9b159fa
imap-client.h: Updated comments.
Timo Sirainen <tss@iki.fi>
parents:
10192
diff
changeset
|
217 the data with "OK ", "NO " or "BAD ". */ |
9219
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
218 void client_send_tagline(struct client_command_context *cmd, const char *data); |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
219 |
10661
bd06d9b159fa
imap-client.h: Updated comments.
Timo Sirainen <tss@iki.fi>
parents:
10192
diff
changeset
|
220 /* Send a BAD command reply to client via client_send_tagline(). If there have |
bd06d9b159fa
imap-client.h: Updated comments.
Timo Sirainen <tss@iki.fi>
parents:
10192
diff
changeset
|
221 been too many command errors, the client is disconnected. msg may be NULL, |
bd06d9b159fa
imap-client.h: Updated comments.
Timo Sirainen <tss@iki.fi>
parents:
10192
diff
changeset
|
222 in which case the error is looked up from imap_parser. */ |
9219
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
223 void client_send_command_error(struct client_command_context *cmd, |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
224 const char *msg); |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
225 |
15066
d419aac7ab31
Added support for IMAP URLAUTH and URLAUTH=BINARY extensions
Stephan Bosch <stephan@rename-it.nl>
parents:
14971
diff
changeset
|
226 /* Send a NO command reply with the default internal error message to client |
d419aac7ab31
Added support for IMAP URLAUTH and URLAUTH=BINARY extensions
Stephan Bosch <stephan@rename-it.nl>
parents:
14971
diff
changeset
|
227 via client_send_tagline(). */ |
d419aac7ab31
Added support for IMAP URLAUTH and URLAUTH=BINARY extensions
Stephan Bosch <stephan@rename-it.nl>
parents:
14971
diff
changeset
|
228 void client_send_internal_error(struct client_command_context *cmd); |
d419aac7ab31
Added support for IMAP URLAUTH and URLAUTH=BINARY extensions
Stephan Bosch <stephan@rename-it.nl>
parents:
14971
diff
changeset
|
229 |
9219
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
230 /* Read a number of arguments. Returns TRUE if everything was read or |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
231 FALSE if either needs more data or error occurred. */ |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
232 bool client_read_args(struct client_command_context *cmd, unsigned int count, |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
233 unsigned int flags, const struct imap_arg **args_r); |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
234 /* Reads a number of string arguments. ... is a list of pointers where to |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
235 store the arguments. */ |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
236 bool client_read_string_args(struct client_command_context *cmd, |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
237 unsigned int count, ...); |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
238 |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
239 /* SEARCHRES extension: Call if $ is being used/updated, returns TRUE if we |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
240 have to wait for an existing SEARCH SAVE to finish. */ |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
241 bool client_handle_search_save_ambiguity(struct client_command_context *cmd); |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
242 |
12550
2c299c0e3bc8
lib-storage: Moved some items from mailbox_get_status() to a new mailbox_get_metadata().
Timo Sirainen <tss@iki.fi>
parents:
12496
diff
changeset
|
243 int client_enable(struct client *client, enum mailbox_feature features); |
9219
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
244 |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
245 struct imap_search_update * |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
246 client_search_update_lookup(struct client *client, const char *tag, |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
247 unsigned int *idx_r); |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
248 void client_search_updates_free(struct client *client); |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
249 |
14899
f9d0ea98157f
imap: Implemented NOTIFY extension.
Timo Sirainen <tss@iki.fi>
parents:
14682
diff
changeset
|
250 struct client_command_context *client_command_alloc(struct client *client); |
9219
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
251 void client_command_cancel(struct client_command_context **cmd); |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
252 void client_command_free(struct client_command_context **cmd); |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
253 |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
254 bool client_handle_unfinished_cmd(struct client_command_context *cmd); |
9385
89d2dbbfa4ca
imap: Cleaned up "command pending" handling code. Should fix hangs caused by recent changes.
Timo Sirainen <tss@iki.fi>
parents:
9355
diff
changeset
|
255 void client_continue_pending_input(struct client *client); |
9219
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
256 |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
257 void client_input(struct client *client); |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
258 bool client_handle_input(struct client *client); |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
259 int client_output(struct client *client); |
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
260 |
17841
576da94fd669
imap, pop3: Show user's proper log prefix when deinitializing users at exit.
Timo Sirainen <tss@iki.fi>
parents:
17070
diff
changeset
|
261 void clients_destroy_all(struct mail_storage_service_ctx *storage_service); |
9355
d6d4ec8ac06d
imap, pop3 no longer assume that there's only a single client in process.
Timo Sirainen <tss@iki.fi>
parents:
9235
diff
changeset
|
262 |
9219
97cdfeb57129
Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff
changeset
|
263 #endif |