annotate src/imap/imap-client.h @ 10696:57814e99b451 HEAD

imap: Added module_contexts to struct client.
author Timo Sirainen <tss@iki.fi>
date Sat, 13 Feb 2010 05:44:09 +0200
parents fd5141e85076
children 8ebf513b875c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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"
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
5
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
6 #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
7 /* 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
8 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
9 resource usage. */
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
10 #define CLIENT_MAX_SEARCH_UPDATES 10
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
11
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
12 struct client;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
13 struct mail_storage;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
14 struct imap_parser;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
15 struct imap_arg;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
16
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
17 struct mailbox_keywords {
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
18 /* 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
19 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
20 const ARRAY_TYPE(keywords) *names;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
21 /* 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
22 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
23 selected. */
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
24 unsigned int announce_count;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
25 };
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
26
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
27 struct imap_search_update {
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
28 char *tag;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
29 struct mail_search_result *result;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
30 bool return_uids;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
31 };
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
32
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
33 enum client_command_state {
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
34 /* Waiting for more input */
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
35 CLIENT_COMMAND_STATE_WAIT_INPUT,
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
36 /* 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
37 CLIENT_COMMAND_STATE_WAIT_OUTPUT,
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
38 /* 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
39 CLIENT_COMMAND_STATE_WAIT_UNAMBIGUITY,
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
40 /* 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
41 CLIENT_COMMAND_STATE_WAIT_SYNC,
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
42 /* Command is finished */
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
43 CLIENT_COMMAND_STATE_DONE
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
44 };
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
45
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
46 struct imap_module_register {
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
47 unsigned int id;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
48 };
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
49
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
50 union imap_module_context {
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
51 struct imap_module_register *reg;
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 extern struct imap_module_register imap_module_register;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
54
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
55 struct client_command_context {
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
56 struct client_command_context *prev, *next;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
57 struct client *client;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
58
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
59 pool_t pool;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
60 /* IMAP command tag */
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
61 const char *tag;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
62 /* Name of this command */
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
63 const char *name;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
64 /* 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
65 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
66 them. */
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
67 const char *args;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
68 enum command_flags cmd_flags;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
69
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
70 command_func_t *func;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
71 void *context;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
72
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
73 /* Module-specific contexts. */
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
74 ARRAY_DEFINE(module_contexts, union imap_module_context *);
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
75
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
76 struct imap_parser *parser;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
77 enum client_command_state state;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
78
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
79 struct client_sync_context *sync;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
80
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
81 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
82 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
83 unsigned int param_error:1;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
84 unsigned int search_save_result:1; /* search result is being updated */
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
85 unsigned int temp_executed:1; /* temporary execution state tracking */
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
86 };
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 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
89 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
90
9219
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
91 int fd_in, fd_out;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
92 struct io *io;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
93 struct istream *input;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
94 struct ostream *output;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
95 struct timeout *to_idle, *to_idle_output;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
96
10696
57814e99b451 imap: Added module_contexts to struct client.
Timo Sirainen <tss@iki.fi>
parents: 10695
diff changeset
97 pool_t pool;
10130
d1384c2b08e5 Merged single and multi mail_storage_service_*() functions.
Timo Sirainen <tss@iki.fi>
parents: 10101
diff changeset
98 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
99 const struct imap_settings *set;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
100 string_t *capability_string;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
101
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
102 struct mail_user *user;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
103 struct mailbox *mailbox;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
104 struct mailbox_keywords keywords;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
105 unsigned int select_counter; /* increased when mailbox is changed */
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
106 unsigned int sync_counter;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
107 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
108 enum mailbox_feature enabled_features;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
109
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
110 time_t last_input, last_output;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
111 unsigned int bad_counter;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
112
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
113 /* 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
114 struct imap_parser *free_parser;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
115 /* 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
116 pool_t command_pool;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
117 /* 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
118 struct client_command_context *command_queue;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
119 unsigned int command_queue_size;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
120
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
121 uint64_t sync_last_full_modseq;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
122 uint64_t highest_fetch_modseq;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
123
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
124 /* SEARCHRES extension: Last saved SEARCH result */
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
125 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
126 /* SEARCH=CONTEXT extension: Searches that get updated */
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
127 ARRAY_DEFINE(search_updates, struct imap_search_update);
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
128
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
129 /* 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
130 struct client_command_context *input_lock;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
131 struct client_command_context *output_lock;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
132 /* command changing the mailbox */
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
133 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
134
10696
57814e99b451 imap: Added module_contexts to struct client.
Timo Sirainen <tss@iki.fi>
parents: 10695
diff changeset
135 /* Module-specific contexts. */
57814e99b451 imap: Added module_contexts to struct client.
Timo Sirainen <tss@iki.fi>
parents: 10695
diff changeset
136 ARRAY_DEFINE(module_contexts, union imap_module_context *);
57814e99b451 imap: Added module_contexts to struct client.
Timo Sirainen <tss@iki.fi>
parents: 10695
diff changeset
137
9219
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
138 /* 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
139 EXPUNGE for Outlook-workaround. */
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
140 unsigned int sync_seen_deletes:1;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
141 unsigned int sync_seen_expunges:1;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
142 unsigned int disconnected:1;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
143 unsigned int destroyed:1;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
144 unsigned int handling_input:1;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
145 unsigned int syncing:1;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
146 unsigned int id_logged:1;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
147 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
148 unsigned int anvil_sent:1;
10695
fd5141e85076 imap: Remember if TLS compression is enabled.
Timo Sirainen <tss@iki.fi>
parents: 10661
diff changeset
149 unsigned int tls_compression:1;
9219
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
150 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
151 found a new line */
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
152 unsigned int modseqs_sent_since_sync:1;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
153 };
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
154
10101
4fe8c4382712 Redesigned how login process passes connections to mail processes and changed related APIs.
Timo Sirainen <tss@iki.fi>
parents: 10093
diff changeset
155 extern struct client *imap_clients;
10192
585bceaf98bb imap: Added support for verbose_proctitle=yes
Timo Sirainen <tss@iki.fi>
parents: 10130
diff changeset
156 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
157
9219
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
158 /* 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
159 if the handle is a socket. */
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
160 struct client *client_create(int fd_in, int fd_out, struct mail_user *user,
10130
d1384c2b08e5 Merged single and multi mail_storage_service_*() functions.
Timo Sirainen <tss@iki.fi>
parents: 10101
diff changeset
161 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
162 const struct imap_settings *set);
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
163 void client_destroy(struct client *client, const char *reason);
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
164
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
165 /* Disconnect client connection */
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
166 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
167 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
168
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
169 /* Send a line of data to client. Returns 1 if ok, 0 if buffer is getting full,
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
170 -1 if error */
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
171 int client_send_line(struct client *client, const char *data);
10661
bd06d9b159fa imap-client.h: Updated comments.
Timo Sirainen <tss@iki.fi>
parents: 10192
diff changeset
172 /* 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
173 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
174 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
175
10661
bd06d9b159fa imap-client.h: Updated comments.
Timo Sirainen <tss@iki.fi>
parents: 10192
diff changeset
176 /* 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
177 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
178 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
179 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
180 const char *msg);
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
181
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
182 /* 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
183 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
184 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
185 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
186 /* 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
187 store the arguments. */
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
188 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
189 unsigned int count, ...);
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
190
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
191 /* 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
192 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
193 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
194
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
195 void client_enable(struct client *client, enum mailbox_feature features);
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
196
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
197 struct imap_search_update *
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
198 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
199 unsigned int *idx_r);
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
200 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
201
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
202 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
203 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
204
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
205 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
206 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
207
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
208 void client_input(struct client *client);
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
209 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
210 int client_output(struct client *client);
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
211
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
212 void clients_destroy_all(void);
d6d4ec8ac06d imap, pop3 no longer assume that there's only a single client in process.
Timo Sirainen <tss@iki.fi>
parents: 9235
diff changeset
213
9219
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
214 #endif