annotate src/imap/imap-client.h @ 21585:1d7bb1681e7b

imap: Add imap_client.logged_out at LOGOUT This is useful for determining if client did a clean logout
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Thu, 16 Feb 2017 20:17:32 +0200
parents 69316c5e2424
children 22f153275e33
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"
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;
19950
4ccd54122839 imap: Made LDA settings accessible from plugins.
Stephan Bosch <stephan@rename-it.nl>
parents: 19495
diff changeset
16 struct lda_settings;
9219
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
17 struct imap_parser;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
18 struct imap_arg;
15066
d419aac7ab31 Added support for IMAP URLAUTH and URLAUTH=BINARY extensions
Stephan Bosch <stephan@rename-it.nl>
parents: 14971
diff changeset
19 struct imap_urlauth_context;
9219
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
20
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
21 struct mailbox_keywords {
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
22 /* 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
23 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
24 const ARRAY_TYPE(keywords) *names;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
25 /* 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
26 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
27 selected. */
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
28 unsigned int announce_count;
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
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
31 struct imap_search_update {
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
32 char *tag;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
33 struct mail_search_result *result;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
34 bool return_uids;
14899
f9d0ea98157f imap: Implemented NOTIFY extension.
Timo Sirainen <tss@iki.fi>
parents: 14682
diff changeset
35
f9d0ea98157f imap: Implemented NOTIFY extension.
Timo Sirainen <tss@iki.fi>
parents: 14682
diff changeset
36 pool_t fetch_pool;
f9d0ea98157f imap: Implemented NOTIFY extension.
Timo Sirainen <tss@iki.fi>
parents: 14682
diff changeset
37 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
38 };
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
39
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
40 enum client_command_state {
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
41 /* Waiting for more input */
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
42 CLIENT_COMMAND_STATE_WAIT_INPUT,
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
43 /* 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
44 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
45 /* Waiting for external interaction */
d419aac7ab31 Added support for IMAP URLAUTH and URLAUTH=BINARY extensions
Stephan Bosch <stephan@rename-it.nl>
parents: 14971
diff changeset
46 CLIENT_COMMAND_STATE_WAIT_EXTERNAL,
9219
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
47 /* 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
48 CLIENT_COMMAND_STATE_WAIT_UNAMBIGUITY,
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
49 /* 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
50 CLIENT_COMMAND_STATE_WAIT_SYNC,
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
51 /* Command is finished */
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
52 CLIENT_COMMAND_STATE_DONE
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
21584
69316c5e2424 imap: Code cleanup - move command stats to struct client_command_stats
Timo Sirainen <timo.sirainen@dovecot.fi>
parents: 21497
diff changeset
55 struct client_command_stats {
69316c5e2424 imap: Code cleanup - move command stats to struct client_command_stats
Timo Sirainen <timo.sirainen@dovecot.fi>
parents: 21497
diff changeset
56 /* time when command handling was started - typically this is after
69316c5e2424 imap: Code cleanup - move command stats to struct client_command_stats
Timo Sirainen <timo.sirainen@dovecot.fi>
parents: 21497
diff changeset
57 reading all the parameters. */
69316c5e2424 imap: Code cleanup - move command stats to struct client_command_stats
Timo Sirainen <timo.sirainen@dovecot.fi>
parents: 21497
diff changeset
58 struct timeval start_time;
69316c5e2424 imap: Code cleanup - move command stats to struct client_command_stats
Timo Sirainen <timo.sirainen@dovecot.fi>
parents: 21497
diff changeset
59 /* time when command handling was last finished. this is before
69316c5e2424 imap: Code cleanup - move command stats to struct client_command_stats
Timo Sirainen <timo.sirainen@dovecot.fi>
parents: 21497
diff changeset
60 mailbox syncing is done. */
69316c5e2424 imap: Code cleanup - move command stats to struct client_command_stats
Timo Sirainen <timo.sirainen@dovecot.fi>
parents: 21497
diff changeset
61 struct timeval last_run_timeval;
69316c5e2424 imap: Code cleanup - move command stats to struct client_command_stats
Timo Sirainen <timo.sirainen@dovecot.fi>
parents: 21497
diff changeset
62 /* io_loop_get_wait_usecs()'s value when the command was started */
69316c5e2424 imap: Code cleanup - move command stats to struct client_command_stats
Timo Sirainen <timo.sirainen@dovecot.fi>
parents: 21497
diff changeset
63 uint64_t start_ioloop_wait_usecs;
69316c5e2424 imap: Code cleanup - move command stats to struct client_command_stats
Timo Sirainen <timo.sirainen@dovecot.fi>
parents: 21497
diff changeset
64 /* how many usecs this command itself has spent running */
69316c5e2424 imap: Code cleanup - move command stats to struct client_command_stats
Timo Sirainen <timo.sirainen@dovecot.fi>
parents: 21497
diff changeset
65 uint64_t running_usecs;
69316c5e2424 imap: Code cleanup - move command stats to struct client_command_stats
Timo Sirainen <timo.sirainen@dovecot.fi>
parents: 21497
diff changeset
66 /* how many usecs this command itself has spent waiting for locks */
69316c5e2424 imap: Code cleanup - move command stats to struct client_command_stats
Timo Sirainen <timo.sirainen@dovecot.fi>
parents: 21497
diff changeset
67 uint64_t lock_wait_usecs;
69316c5e2424 imap: Code cleanup - move command stats to struct client_command_stats
Timo Sirainen <timo.sirainen@dovecot.fi>
parents: 21497
diff changeset
68 /* how many bytes of client input/output command has used */
69316c5e2424 imap: Code cleanup - move command stats to struct client_command_stats
Timo Sirainen <timo.sirainen@dovecot.fi>
parents: 21497
diff changeset
69 uint64_t bytes_in, bytes_out;
69316c5e2424 imap: Code cleanup - move command stats to struct client_command_stats
Timo Sirainen <timo.sirainen@dovecot.fi>
parents: 21497
diff changeset
70 };
69316c5e2424 imap: Code cleanup - move command stats to struct client_command_stats
Timo Sirainen <timo.sirainen@dovecot.fi>
parents: 21497
diff changeset
71
9219
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
72 struct client_command_context {
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
73 struct client_command_context *prev, *next;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
74 struct client *client;
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 pool_t pool;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
77 /* IMAP command tag */
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
78 const char *tag;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
79 /* Name of this command */
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
80 const char *name;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
81 /* 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
82 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
83 them. */
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
84 const char *args;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
85 enum command_flags cmd_flags;
20123
488347132580 imap: Added struct client_command_context.tagline_reply
Timo Sirainen <timo.sirainen@dovecot.fi>
parents: 19950
diff changeset
86 const char *tagline_reply;
9219
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 command_func_t *func;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
89 void *context;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
90
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
91 /* Module-specific contexts. */
14920
a097ef0a9d6d Array API changed: ARRAY_DEFINE(name, type) -> ARRAY(type) name
Timo Sirainen <tss@iki.fi>
parents: 14899
diff changeset
92 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
93
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
94 struct imap_parser *parser;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
95 enum client_command_state state;
21584
69316c5e2424 imap: Code cleanup - move command stats to struct client_command_stats
Timo Sirainen <timo.sirainen@dovecot.fi>
parents: 21497
diff changeset
96 struct client_command_stats stats;
9219
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
97
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
98 struct client_sync_context *sync;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
99
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
100 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
101 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
102 unsigned int param_error:1;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
103 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
104 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
105 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
106 unsigned int tagline_sent:1;
19495
4535ac0b8ab1 imap: Added assert to make sure client_command_context isn't freed too early.
Timo Sirainen <tss@iki.fi>
parents: 19415
diff changeset
107 unsigned int executing:1;
9219
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
108 };
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
109
14219
e20af99c6d20 imap: Made client_destroy() a virtual method.
Timo Sirainen <tss@iki.fi>
parents: 13563
diff changeset
110 struct imap_client_vfuncs {
18996
64c73e6bd397 Added imap-hibernate process for gathering IDLEing imap processes.
Timo Sirainen <tss@iki.fi>
parents: 18707
diff changeset
111 /* Export client state into buffer. Returns 1 if ok, 0 if some state
64c73e6bd397 Added imap-hibernate process for gathering IDLEing imap processes.
Timo Sirainen <tss@iki.fi>
parents: 18707
diff changeset
112 couldn't be preserved, -1 if temporary internal error occurred. */
64c73e6bd397 Added imap-hibernate process for gathering IDLEing imap processes.
Timo Sirainen <tss@iki.fi>
parents: 18707
diff changeset
113 int (*state_export)(struct client *client, bool internal,
64c73e6bd397 Added imap-hibernate process for gathering IDLEing imap processes.
Timo Sirainen <tss@iki.fi>
parents: 18707
diff changeset
114 buffer_t *dest, const char **error_r);
64c73e6bd397 Added imap-hibernate process for gathering IDLEing imap processes.
Timo Sirainen <tss@iki.fi>
parents: 18707
diff changeset
115 /* Import a single block of client state from the given data. Returns
64c73e6bd397 Added imap-hibernate process for gathering IDLEing imap processes.
Timo Sirainen <tss@iki.fi>
parents: 18707
diff changeset
116 number of bytes successfully imported from the block, or 0 if state
64c73e6bd397 Added imap-hibernate process for gathering IDLEing imap processes.
Timo Sirainen <tss@iki.fi>
parents: 18707
diff changeset
117 is corrupted or contains unknown data (e.g. some plugin is no longer
64c73e6bd397 Added imap-hibernate process for gathering IDLEing imap processes.
Timo Sirainen <tss@iki.fi>
parents: 18707
diff changeset
118 loaded), -1 if temporary internal error occurred. */
64c73e6bd397 Added imap-hibernate process for gathering IDLEing imap processes.
Timo Sirainen <tss@iki.fi>
parents: 18707
diff changeset
119 ssize_t (*state_import)(struct client *client, bool internal,
64c73e6bd397 Added imap-hibernate process for gathering IDLEing imap processes.
Timo Sirainen <tss@iki.fi>
parents: 18707
diff changeset
120 const unsigned char *data, size_t size,
64c73e6bd397 Added imap-hibernate process for gathering IDLEing imap processes.
Timo Sirainen <tss@iki.fi>
parents: 18707
diff changeset
121 const char **error_r);
14219
e20af99c6d20 imap: Made client_destroy() a virtual method.
Timo Sirainen <tss@iki.fi>
parents: 13563
diff changeset
122 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
123 };
e20af99c6d20 imap: Made client_destroy() a virtual method.
Timo Sirainen <tss@iki.fi>
parents: 13563
diff changeset
124
9219
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
125 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
126 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
127
14219
e20af99c6d20 imap: Made client_destroy() a virtual method.
Timo Sirainen <tss@iki.fi>
parents: 13563
diff changeset
128 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
129 const char *session_id;
18996
64c73e6bd397 Added imap-hibernate process for gathering IDLEing imap processes.
Timo Sirainen <tss@iki.fi>
parents: 18707
diff changeset
130 const char *const *userdb_fields; /* for internal session saving/restoring */
14219
e20af99c6d20 imap: Made client_destroy() a virtual method.
Timo Sirainen <tss@iki.fi>
parents: 13563
diff changeset
131
9219
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
132 int fd_in, fd_out;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
133 struct io *io;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
134 struct istream *input;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
135 struct ostream *output;
15066
d419aac7ab31 Added support for IMAP URLAUTH and URLAUTH=BINARY extensions
Stephan Bosch <stephan@rename-it.nl>
parents: 14971
diff changeset
136 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
137
10696
57814e99b451 imap: Added module_contexts to struct client.
Timo Sirainen <tss@iki.fi>
parents: 10695
diff changeset
138 pool_t pool;
10130
d1384c2b08e5 Merged single and multi mail_storage_service_*() functions.
Timo Sirainen <tss@iki.fi>
parents: 10101
diff changeset
139 struct mail_storage_service_user *service_user;
19950
4ccd54122839 imap: Made LDA settings accessible from plugins.
Stephan Bosch <stephan@rename-it.nl>
parents: 19495
diff changeset
140 const struct imap_settings *set;
4ccd54122839 imap: Made LDA settings accessible from plugins.
Stephan Bosch <stephan@rename-it.nl>
parents: 19495
diff changeset
141 const struct lda_settings *lda_set;
9219
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
142 string_t *capability_string;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
143
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
144 struct mail_user *user;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
145 struct mailbox *mailbox;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
146 struct mailbox_keywords keywords;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
147 unsigned int sync_counter;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
148 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
149 enum mailbox_feature enabled_features;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
150
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
151 time_t last_input, last_output;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
152 unsigned int bad_counter;
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 /* 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
155 struct imap_parser *free_parser;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
156 /* 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
157 pool_t command_pool;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
158 /* 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
159 struct client_command_context *command_queue;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
160 unsigned int command_queue_size;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
161
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
162 uint64_t sync_last_full_modseq;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
163 uint64_t highest_fetch_modseq;
21497
1f04b10661cc imap: Add imap_fetch_failure setting
Timo Sirainen <timo.sirainen@dovecot.fi>
parents: 20686
diff changeset
164 ARRAY_TYPE(seq_range) fetch_failed_uids;
9219
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
165
18706
93bba97afb2a Added %{fetch_hdr/body_count/bytes} variables to imap_logout_format
Timo Sirainen <tss@iki.fi>
parents: 18432
diff changeset
166 /* 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
167 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
168 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
169 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
170
9219
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
171 /* SEARCHRES extension: Last saved SEARCH result */
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
172 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
173 /* 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
174 ARRAY(struct imap_search_update) search_updates;
14899
f9d0ea98157f imap: Implemented NOTIFY extension.
Timo Sirainen <tss@iki.fi>
parents: 14682
diff changeset
175 /* NOTIFY extension */
f9d0ea98157f imap: Implemented NOTIFY extension.
Timo Sirainen <tss@iki.fi>
parents: 14682
diff changeset
176 struct imap_notify_context *notify_ctx;
f9d0ea98157f imap: Implemented NOTIFY extension.
Timo Sirainen <tss@iki.fi>
parents: 14682
diff changeset
177 uint32_t notify_uidnext;
9219
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
178
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
179 /* 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
180 struct client_command_context *input_lock;
14899
f9d0ea98157f imap: Implemented NOTIFY extension.
Timo Sirainen <tss@iki.fi>
parents: 14682
diff changeset
181 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
182 /* command changing the mailbox */
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
183 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
184
15066
d419aac7ab31 Added support for IMAP URLAUTH and URLAUTH=BINARY extensions
Stephan Bosch <stephan@rename-it.nl>
parents: 14971
diff changeset
185 /* IMAP URLAUTH context (RFC4467) */
d419aac7ab31 Added support for IMAP URLAUTH and URLAUTH=BINARY extensions
Stephan Bosch <stephan@rename-it.nl>
parents: 14971
diff changeset
186 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
187
10696
57814e99b451 imap: Added module_contexts to struct client.
Timo Sirainen <tss@iki.fi>
parents: 10695
diff changeset
188 /* Module-specific contexts. */
14920
a097ef0a9d6d Array API changed: ARRAY_DEFINE(name, type) -> ARRAY(type) name
Timo Sirainen <tss@iki.fi>
parents: 14899
diff changeset
189 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
190
9219
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
191 /* 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
192 EXPUNGE for Outlook-workaround. */
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
193 unsigned int sync_seen_deletes:1;
21585
1d7bb1681e7b imap: Add imap_client.logged_out at LOGOUT
Timo Sirainen <timo.sirainen@dovecot.fi>
parents: 21584
diff changeset
194 unsigned int logged_out:1;
9219
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
195 unsigned int disconnected:1;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
196 unsigned int destroyed:1;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
197 unsigned int handling_input:1;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
198 unsigned int syncing:1;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
199 unsigned int id_logged:1;
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
200 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
201 unsigned int anvil_sent:1;
10695
fd5141e85076 imap: Remember if TLS compression is enabled.
Timo Sirainen <tss@iki.fi>
parents: 10661
diff changeset
202 unsigned int tls_compression:1;
9219
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
203 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
204 found a new line */
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
205 unsigned int modseqs_sent_since_sync:1;
14899
f9d0ea98157f imap: Implemented NOTIFY extension.
Timo Sirainen <tss@iki.fi>
parents: 14682
diff changeset
206 unsigned int notify_immediate_expunges:1;
f9d0ea98157f imap: Implemented NOTIFY extension.
Timo Sirainen <tss@iki.fi>
parents: 14682
diff changeset
207 unsigned int notify_count_changes:1;
f9d0ea98157f imap: Implemented NOTIFY extension.
Timo Sirainen <tss@iki.fi>
parents: 14682
diff changeset
208 unsigned int notify_flag_changes:1;
16916
0a08efeb3f40 imap: Added initial support for METADATA extension.
Timo Sirainen <tss@iki.fi>
parents: 15178
diff changeset
209 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
210 unsigned int nonpermanent_modseqs:1;
18996
64c73e6bd397 Added imap-hibernate process for gathering IDLEing imap processes.
Timo Sirainen <tss@iki.fi>
parents: 18707
diff changeset
211 unsigned int state_import_bad_idle_done:1;
64c73e6bd397 Added imap-hibernate process for gathering IDLEing imap processes.
Timo Sirainen <tss@iki.fi>
parents: 18707
diff changeset
212 unsigned int state_import_idle_continue:1;
9219
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
213 };
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
214
14219
e20af99c6d20 imap: Made client_destroy() a virtual method.
Timo Sirainen <tss@iki.fi>
parents: 13563
diff changeset
215 struct imap_module_register {
e20af99c6d20 imap: Made client_destroy() a virtual method.
Timo Sirainen <tss@iki.fi>
parents: 13563
diff changeset
216 unsigned int id;
e20af99c6d20 imap: Made client_destroy() a virtual method.
Timo Sirainen <tss@iki.fi>
parents: 13563
diff changeset
217 };
e20af99c6d20 imap: Made client_destroy() a virtual method.
Timo Sirainen <tss@iki.fi>
parents: 13563
diff changeset
218
e20af99c6d20 imap: Made client_destroy() a virtual method.
Timo Sirainen <tss@iki.fi>
parents: 13563
diff changeset
219 union imap_module_context {
e20af99c6d20 imap: Made client_destroy() a virtual method.
Timo Sirainen <tss@iki.fi>
parents: 13563
diff changeset
220 struct imap_client_vfuncs super;
e20af99c6d20 imap: Made client_destroy() a virtual method.
Timo Sirainen <tss@iki.fi>
parents: 13563
diff changeset
221 struct imap_module_register *reg;
e20af99c6d20 imap: Made client_destroy() a virtual method.
Timo Sirainen <tss@iki.fi>
parents: 13563
diff changeset
222 };
e20af99c6d20 imap: Made client_destroy() a virtual method.
Timo Sirainen <tss@iki.fi>
parents: 13563
diff changeset
223 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
224
10101
4fe8c4382712 Redesigned how login process passes connections to mail processes and changed related APIs.
Timo Sirainen <tss@iki.fi>
parents: 10093
diff changeset
225 extern struct client *imap_clients;
10192
585bceaf98bb imap: Added support for verbose_proctitle=yes
Timo Sirainen <tss@iki.fi>
parents: 10130
diff changeset
226 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
227
9219
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
228 /* 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
229 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
230 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
231 struct mail_user *user,
10130
d1384c2b08e5 Merged single and multi mail_storage_service_*() functions.
Timo Sirainen <tss@iki.fi>
parents: 10101
diff changeset
232 struct mail_storage_service_user *service_user,
19950
4ccd54122839 imap: Made LDA settings accessible from plugins.
Stephan Bosch <stephan@rename-it.nl>
parents: 19495
diff changeset
233 const struct imap_settings *set,
4ccd54122839 imap: Made LDA settings accessible from plugins.
Stephan Bosch <stephan@rename-it.nl>
parents: 19495
diff changeset
234 const struct lda_settings *lda_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
235 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
236
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
237 /* Disconnect client connection */
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
238 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
239 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
240
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
241 /* 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
242 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
243 /* 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
244 -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
245 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
246 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
247 /* 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
248 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
249 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
250
10661
bd06d9b159fa imap-client.h: Updated comments.
Timo Sirainen <tss@iki.fi>
parents: 10192
diff changeset
251 /* 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
252 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
253 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
254 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
255 const char *msg);
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
256
15066
d419aac7ab31 Added support for IMAP URLAUTH and URLAUTH=BINARY extensions
Stephan Bosch <stephan@rename-it.nl>
parents: 14971
diff changeset
257 /* 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
258 via client_send_tagline(). */
d419aac7ab31 Added support for IMAP URLAUTH and URLAUTH=BINARY extensions
Stephan Bosch <stephan@rename-it.nl>
parents: 14971
diff changeset
259 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
260
9219
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
261 /* 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
262 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
263 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
264 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
265 /* 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
266 store the arguments. */
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
267 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
268 unsigned int count, ...);
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
269
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
270 /* 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
271 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
272 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
273
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
274 int client_enable(struct client *client, enum mailbox_feature features);
18996
64c73e6bd397 Added imap-hibernate process for gathering IDLEing imap processes.
Timo Sirainen <tss@iki.fi>
parents: 18707
diff changeset
275 /* Send client processing to imap-idle process. If successful, returns TRUE
64c73e6bd397 Added imap-hibernate process for gathering IDLEing imap processes.
Timo Sirainen <tss@iki.fi>
parents: 18707
diff changeset
276 and destroys the client. */
64c73e6bd397 Added imap-hibernate process for gathering IDLEing imap processes.
Timo Sirainen <tss@iki.fi>
parents: 18707
diff changeset
277 bool imap_client_hibernate(struct client **client);
9219
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
278
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
279 struct imap_search_update *
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
280 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
281 unsigned int *idx_r);
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
282 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
283
14899
f9d0ea98157f imap: Implemented NOTIFY extension.
Timo Sirainen <tss@iki.fi>
parents: 14682
diff changeset
284 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
285 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
286 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
287
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
288 bool client_handle_unfinished_cmd(struct client_command_context *cmd);
19415
ecfd706b0e21 imap: Added extra assert checks to make sure command states are consistent.
Timo Sirainen <tss@iki.fi>
parents: 19164
diff changeset
289 /* Handle any pending command input. This must be run at the end of all
ecfd706b0e21 imap: Added extra assert checks to make sure command states are consistent.
Timo Sirainen <tss@iki.fi>
parents: 19164
diff changeset
290 I/O callbacks after they've (potentially) finished some commands. */
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
291 void client_continue_pending_input(struct client *client);
18996
64c73e6bd397 Added imap-hibernate process for gathering IDLEing imap processes.
Timo Sirainen <tss@iki.fi>
parents: 18707
diff changeset
292 void client_add_missing_io(struct client *client);
64c73e6bd397 Added imap-hibernate process for gathering IDLEing imap processes.
Timo Sirainen <tss@iki.fi>
parents: 18707
diff changeset
293 const char *client_stats(struct client *client);
9219
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
294
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
295 void client_input(struct client *client);
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
296 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
297 int client_output(struct client *client);
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
298
17841
576da94fd669 imap, pop3: Show user's proper log prefix when deinitializing users at exit.
Timo Sirainen <tss@iki.fi>
parents: 17070
diff changeset
299 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
300
9219
97cdfeb57129 Renamed headers to prevent collision if they were flattened on an install.
Mark Washenberger
parents:
diff changeset
301 #endif