Mercurial > dovecot > original-hg > dovecot-1.2
annotate src/imap/client.h @ 8731:3949c6d2e4c8 HEAD
imap: Added module contexts to struct client_command_context.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Fri, 06 Feb 2009 13:49:07 -0500 |
parents | 9b5d68776d03 |
children | 9a0aa39a3a14 |
rev | line source |
---|---|
6410
e4eb71ae8e96
Changed .h ifdef/defines to use <NAME>_H format.
Timo Sirainen <tss@iki.fi>
parents:
6210
diff
changeset
|
1 #ifndef CLIENT_H |
e4eb71ae8e96
Changed .h ifdef/defines to use <NAME>_H format.
Timo Sirainen <tss@iki.fi>
parents:
6210
diff
changeset
|
2 #define CLIENT_H |
0 | 3 |
3139 | 4 #include "commands.h" |
5 | |
4939
ff2272c228cc
Dovecot is now able to execute multiple commands at the same time.
Timo Sirainen <tss@iki.fi>
parents:
4907
diff
changeset
|
6 #define CLIENT_COMMAND_QUEUE_MAX_SIZE 4 |
7647
879208fdc7e3
Implemented CONTEXT=SEARCH extension.
Timo Sirainen <tss@iki.fi>
parents:
7639
diff
changeset
|
7 /* Maximum number of CONTEXT=SEARCH UPDATEs. Clients probably won't need more |
879208fdc7e3
Implemented CONTEXT=SEARCH extension.
Timo Sirainen <tss@iki.fi>
parents:
7639
diff
changeset
|
8 than a few, so this is mainly to avoid more or less accidental pointless |
879208fdc7e3
Implemented CONTEXT=SEARCH extension.
Timo Sirainen <tss@iki.fi>
parents:
7639
diff
changeset
|
9 resource usage. */ |
879208fdc7e3
Implemented CONTEXT=SEARCH extension.
Timo Sirainen <tss@iki.fi>
parents:
7639
diff
changeset
|
10 #define CLIENT_MAX_SEARCH_UPDATES 10 |
4939
ff2272c228cc
Dovecot is now able to execute multiple commands at the same time.
Timo Sirainen <tss@iki.fi>
parents:
4907
diff
changeset
|
11 |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
764
diff
changeset
|
12 struct client; |
1041 | 13 struct mail_storage; |
14 struct imap_parser; | |
15 struct imap_arg; | |
0 | 16 |
1958 | 17 struct mailbox_keywords { |
7057
81f4c9689c18
FLAGS/PERMENENTFLAGS weren't always sent to client early enough. Also
Timo Sirainen <tss@iki.fi>
parents:
6531
diff
changeset
|
18 /* All keyword names. The array itself exists in mail_index. |
81f4c9689c18
FLAGS/PERMENENTFLAGS weren't always sent to client early enough. Also
Timo Sirainen <tss@iki.fi>
parents:
6531
diff
changeset
|
19 Keywords are currently only appended, they're never removed. */ |
81f4c9689c18
FLAGS/PERMENENTFLAGS weren't always sent to client early enough. Also
Timo Sirainen <tss@iki.fi>
parents:
6531
diff
changeset
|
20 const ARRAY_TYPE(keywords) *names; |
81f4c9689c18
FLAGS/PERMENENTFLAGS weren't always sent to client early enough. Also
Timo Sirainen <tss@iki.fi>
parents:
6531
diff
changeset
|
21 /* Number of keywords announced to client via FLAGS/PERMANENTFLAGS. |
81f4c9689c18
FLAGS/PERMENENTFLAGS weren't always sent to client early enough. Also
Timo Sirainen <tss@iki.fi>
parents:
6531
diff
changeset
|
22 This relies on keywords not being removed while mailbox is |
81f4c9689c18
FLAGS/PERMENENTFLAGS weren't always sent to client early enough. Also
Timo Sirainen <tss@iki.fi>
parents:
6531
diff
changeset
|
23 selected. */ |
81f4c9689c18
FLAGS/PERMENENTFLAGS weren't always sent to client early enough. Also
Timo Sirainen <tss@iki.fi>
parents:
6531
diff
changeset
|
24 unsigned int announce_count; |
1168
03f1455664d7
Added setting to limit length of custom flag names.
Timo Sirainen <tss@iki.fi>
parents:
1041
diff
changeset
|
25 }; |
03f1455664d7
Added setting to limit length of custom flag names.
Timo Sirainen <tss@iki.fi>
parents:
1041
diff
changeset
|
26 |
7647
879208fdc7e3
Implemented CONTEXT=SEARCH extension.
Timo Sirainen <tss@iki.fi>
parents:
7639
diff
changeset
|
27 struct imap_search_update { |
879208fdc7e3
Implemented CONTEXT=SEARCH extension.
Timo Sirainen <tss@iki.fi>
parents:
7639
diff
changeset
|
28 char *tag; |
879208fdc7e3
Implemented CONTEXT=SEARCH extension.
Timo Sirainen <tss@iki.fi>
parents:
7639
diff
changeset
|
29 struct mail_search_result *result; |
879208fdc7e3
Implemented CONTEXT=SEARCH extension.
Timo Sirainen <tss@iki.fi>
parents:
7639
diff
changeset
|
30 bool return_uids; |
879208fdc7e3
Implemented CONTEXT=SEARCH extension.
Timo Sirainen <tss@iki.fi>
parents:
7639
diff
changeset
|
31 }; |
879208fdc7e3
Implemented CONTEXT=SEARCH extension.
Timo Sirainen <tss@iki.fi>
parents:
7639
diff
changeset
|
32 |
7148
5e3188213724
Added "command state" for running commands. Use it instead of some bitfields
Timo Sirainen <tss@iki.fi>
parents:
7103
diff
changeset
|
33 enum client_command_state { |
5e3188213724
Added "command state" for running commands. Use it instead of some bitfields
Timo Sirainen <tss@iki.fi>
parents:
7103
diff
changeset
|
34 /* Waiting for more input */ |
5e3188213724
Added "command state" for running commands. Use it instead of some bitfields
Timo Sirainen <tss@iki.fi>
parents:
7103
diff
changeset
|
35 CLIENT_COMMAND_STATE_WAIT_INPUT, |
5e3188213724
Added "command state" for running commands. Use it instead of some bitfields
Timo Sirainen <tss@iki.fi>
parents:
7103
diff
changeset
|
36 /* Waiting to be able to send more output */ |
5e3188213724
Added "command state" for running commands. Use it instead of some bitfields
Timo Sirainen <tss@iki.fi>
parents:
7103
diff
changeset
|
37 CLIENT_COMMAND_STATE_WAIT_OUTPUT, |
7149
323b425a0f46
Replaced waiting_ambiguity bitmask with a command state.
Timo Sirainen <tss@iki.fi>
parents:
7148
diff
changeset
|
38 /* Wait for other commands to finish execution */ |
323b425a0f46
Replaced waiting_ambiguity bitmask with a command state.
Timo Sirainen <tss@iki.fi>
parents:
7148
diff
changeset
|
39 CLIENT_COMMAND_STATE_WAIT_UNAMBIGUITY, |
7195
bca55675d77c
When pipelining commands, delay synchronizations so that only one combined
Timo Sirainen <tss@iki.fi>
parents:
7151
diff
changeset
|
40 /* Waiting for other commands to finish so we can sync */ |
bca55675d77c
When pipelining commands, delay synchronizations so that only one combined
Timo Sirainen <tss@iki.fi>
parents:
7151
diff
changeset
|
41 CLIENT_COMMAND_STATE_WAIT_SYNC, |
7148
5e3188213724
Added "command state" for running commands. Use it instead of some bitfields
Timo Sirainen <tss@iki.fi>
parents:
7103
diff
changeset
|
42 /* Command is finished */ |
5e3188213724
Added "command state" for running commands. Use it instead of some bitfields
Timo Sirainen <tss@iki.fi>
parents:
7103
diff
changeset
|
43 CLIENT_COMMAND_STATE_DONE |
5e3188213724
Added "command state" for running commands. Use it instead of some bitfields
Timo Sirainen <tss@iki.fi>
parents:
7103
diff
changeset
|
44 }; |
5e3188213724
Added "command state" for running commands. Use it instead of some bitfields
Timo Sirainen <tss@iki.fi>
parents:
7103
diff
changeset
|
45 |
8731
3949c6d2e4c8
imap: Added module contexts to struct client_command_context.
Timo Sirainen <tss@iki.fi>
parents:
8730
diff
changeset
|
46 struct imap_module_register { |
3949c6d2e4c8
imap: Added module contexts to struct client_command_context.
Timo Sirainen <tss@iki.fi>
parents:
8730
diff
changeset
|
47 unsigned int id; |
3949c6d2e4c8
imap: Added module contexts to struct client_command_context.
Timo Sirainen <tss@iki.fi>
parents:
8730
diff
changeset
|
48 }; |
3949c6d2e4c8
imap: Added module contexts to struct client_command_context.
Timo Sirainen <tss@iki.fi>
parents:
8730
diff
changeset
|
49 |
3949c6d2e4c8
imap: Added module contexts to struct client_command_context.
Timo Sirainen <tss@iki.fi>
parents:
8730
diff
changeset
|
50 union imap_module_context { |
3949c6d2e4c8
imap: Added module contexts to struct client_command_context.
Timo Sirainen <tss@iki.fi>
parents:
8730
diff
changeset
|
51 struct imap_module_register *reg; |
3949c6d2e4c8
imap: Added module contexts to struct client_command_context.
Timo Sirainen <tss@iki.fi>
parents:
8730
diff
changeset
|
52 }; |
3949c6d2e4c8
imap: Added module contexts to struct client_command_context.
Timo Sirainen <tss@iki.fi>
parents:
8730
diff
changeset
|
53 extern struct imap_module_register imap_module_register; |
3949c6d2e4c8
imap: Added module contexts to struct client_command_context.
Timo Sirainen <tss@iki.fi>
parents:
8730
diff
changeset
|
54 |
3141
61abed5f7864
Moved command-specific variables from struct client to struct
Timo Sirainen <tss@iki.fi>
parents:
3139
diff
changeset
|
55 struct client_command_context { |
4939
ff2272c228cc
Dovecot is now able to execute multiple commands at the same time.
Timo Sirainen <tss@iki.fi>
parents:
4907
diff
changeset
|
56 struct client_command_context *prev, *next; |
3141
61abed5f7864
Moved command-specific variables from struct client to struct
Timo Sirainen <tss@iki.fi>
parents:
3139
diff
changeset
|
57 struct client *client; |
61abed5f7864
Moved command-specific variables from struct client to struct
Timo Sirainen <tss@iki.fi>
parents:
3139
diff
changeset
|
58 |
61abed5f7864
Moved command-specific variables from struct client to struct
Timo Sirainen <tss@iki.fi>
parents:
3139
diff
changeset
|
59 pool_t pool; |
8730
9b5d68776d03
imap: Store command args to client command contexts for debugging purposes.
Timo Sirainen <tss@iki.fi>
parents:
8082
diff
changeset
|
60 /* IMAP command tag */ |
3141
61abed5f7864
Moved command-specific variables from struct client to struct
Timo Sirainen <tss@iki.fi>
parents:
3139
diff
changeset
|
61 const char *tag; |
8730
9b5d68776d03
imap: Store command args to client command contexts for debugging purposes.
Timo Sirainen <tss@iki.fi>
parents:
8082
diff
changeset
|
62 /* Name of this command */ |
3141
61abed5f7864
Moved command-specific variables from struct client to struct
Timo Sirainen <tss@iki.fi>
parents:
3139
diff
changeset
|
63 const char *name; |
8730
9b5d68776d03
imap: Store command args to client command contexts for debugging purposes.
Timo Sirainen <tss@iki.fi>
parents:
8082
diff
changeset
|
64 /* Parameters for this command. These are generated from parsed IMAP |
9b5d68776d03
imap: Store command args to client command contexts for debugging purposes.
Timo Sirainen <tss@iki.fi>
parents:
8082
diff
changeset
|
65 arguments, so they may not be exactly the same as how client sent |
9b5d68776d03
imap: Store command args to client command contexts for debugging purposes.
Timo Sirainen <tss@iki.fi>
parents:
8082
diff
changeset
|
66 them. */ |
9b5d68776d03
imap: Store command args to client command contexts for debugging purposes.
Timo Sirainen <tss@iki.fi>
parents:
8082
diff
changeset
|
67 const char *args; |
4941
f612d2086448
If running commands in parallel would cause ambiguity, run them
Timo Sirainen <tss@iki.fi>
parents:
4939
diff
changeset
|
68 enum command_flags cmd_flags; |
3141
61abed5f7864
Moved command-specific variables from struct client to struct
Timo Sirainen <tss@iki.fi>
parents:
3139
diff
changeset
|
69 |
61abed5f7864
Moved command-specific variables from struct client to struct
Timo Sirainen <tss@iki.fi>
parents:
3139
diff
changeset
|
70 command_func_t *func; |
61abed5f7864
Moved command-specific variables from struct client to struct
Timo Sirainen <tss@iki.fi>
parents:
3139
diff
changeset
|
71 void *context; |
61abed5f7864
Moved command-specific variables from struct client to struct
Timo Sirainen <tss@iki.fi>
parents:
3139
diff
changeset
|
72 |
8731
3949c6d2e4c8
imap: Added module contexts to struct client_command_context.
Timo Sirainen <tss@iki.fi>
parents:
8730
diff
changeset
|
73 /* Module-specific contexts. */ |
3949c6d2e4c8
imap: Added module contexts to struct client_command_context.
Timo Sirainen <tss@iki.fi>
parents:
8730
diff
changeset
|
74 ARRAY_DEFINE(module_contexts, union imap_module_context *); |
3949c6d2e4c8
imap: Added module contexts to struct client_command_context.
Timo Sirainen <tss@iki.fi>
parents:
8730
diff
changeset
|
75 |
4939
ff2272c228cc
Dovecot is now able to execute multiple commands at the same time.
Timo Sirainen <tss@iki.fi>
parents:
4907
diff
changeset
|
76 struct imap_parser *parser; |
7148
5e3188213724
Added "command state" for running commands. Use it instead of some bitfields
Timo Sirainen <tss@iki.fi>
parents:
7103
diff
changeset
|
77 enum client_command_state state; |
4939
ff2272c228cc
Dovecot is now able to execute multiple commands at the same time.
Timo Sirainen <tss@iki.fi>
parents:
4907
diff
changeset
|
78 |
7353
33304b5f6070
Syncing supports now calling a callback after sync instead of just sending a
Timo Sirainen <tss@iki.fi>
parents:
7195
diff
changeset
|
79 struct client_sync_context *sync; |
7195
bca55675d77c
When pipelining commands, delay synchronizations so that only one combined
Timo Sirainen <tss@iki.fi>
parents:
7151
diff
changeset
|
80 |
3141
61abed5f7864
Moved command-specific variables from struct client to struct
Timo Sirainen <tss@iki.fi>
parents:
3139
diff
changeset
|
81 unsigned int uid:1; /* used UID command */ |
4939
ff2272c228cc
Dovecot is now able to execute multiple commands at the same time.
Timo Sirainen <tss@iki.fi>
parents:
4907
diff
changeset
|
82 unsigned int cancel:1; /* command is wanted to be cancelled */ |
3141
61abed5f7864
Moved command-specific variables from struct client to struct
Timo Sirainen <tss@iki.fi>
parents:
3139
diff
changeset
|
83 unsigned int param_error:1; |
7639
03146f02403f
Implemented SEARCHRES extension.
Timo Sirainen <tss@iki.fi>
parents:
7635
diff
changeset
|
84 unsigned int search_save_result:1; /* search result is being updated */ |
7151
2ced9dd8b2cc
Use more robust command calling in output handler.
Timo Sirainen <tss@iki.fi>
parents:
7149
diff
changeset
|
85 unsigned int temp_executed:1; /* temporary execution state tracking */ |
3141
61abed5f7864
Moved command-specific variables from struct client to struct
Timo Sirainen <tss@iki.fi>
parents:
3139
diff
changeset
|
86 }; |
61abed5f7864
Moved command-specific variables from struct client to struct
Timo Sirainen <tss@iki.fi>
parents:
3139
diff
changeset
|
87 |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
764
diff
changeset
|
88 struct client { |
3960
aeb424e64f24
Call io_remove() before closing the fd. It's required by kqueue.
Timo Sirainen <tss@iki.fi>
parents:
3871
diff
changeset
|
89 int fd_in, fd_out; |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
764
diff
changeset
|
90 struct io *io; |
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
764
diff
changeset
|
91 struct istream *input; |
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
764
diff
changeset
|
92 struct ostream *output; |
7103
284dd5f2777d
Use separate idle timeouts to avoid unneededly checking them every n seconds.
Timo Sirainen <tss@iki.fi>
parents:
7057
diff
changeset
|
93 struct timeout *to_idle, *to_idle_output; |
0 | 94 |
8082
db66611fd195
Added struct mail_user and fixed the code to support multiple users per process.
Timo Sirainen <tss@iki.fi>
parents:
8063
diff
changeset
|
95 struct mail_user *user; |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
764
diff
changeset
|
96 struct mailbox *mailbox; |
1958 | 97 struct mailbox_keywords keywords; |
991
21788a1e9e39
Partial fetches are working fast again - faster than ever actually.
Timo Sirainen <tss@iki.fi>
parents:
953
diff
changeset
|
98 unsigned int select_counter; /* increased when mailbox is changed */ |
7195
bca55675d77c
When pipelining commands, delay synchronizations so that only one combined
Timo Sirainen <tss@iki.fi>
parents:
7151
diff
changeset
|
99 unsigned int sync_counter; |
5848
064aa8ff69c2
Disconnect client if UIDVALIDITY changes.
Timo Sirainen <tss@iki.fi>
parents:
5835
diff
changeset
|
100 uint32_t messages_count, recent_count, uidvalidity; |
7620 | 101 enum mailbox_feature enabled_features; |
0 | 102 |
2421
d141e1bfdd63
We never do blocking reads/writes to network anymore. Changed imap and pop3
Timo Sirainen <tss@iki.fi>
parents:
2322
diff
changeset
|
103 time_t last_input, last_output; |
0 | 104 unsigned int bad_counter; |
105 | |
4939
ff2272c228cc
Dovecot is now able to execute multiple commands at the same time.
Timo Sirainen <tss@iki.fi>
parents:
4907
diff
changeset
|
106 /* one parser is kept here to be used for new commands */ |
ff2272c228cc
Dovecot is now able to execute multiple commands at the same time.
Timo Sirainen <tss@iki.fi>
parents:
4907
diff
changeset
|
107 struct imap_parser *free_parser; |
ff2272c228cc
Dovecot is now able to execute multiple commands at the same time.
Timo Sirainen <tss@iki.fi>
parents:
4907
diff
changeset
|
108 /* command_pool is cleared when the command queue gets empty */ |
ff2272c228cc
Dovecot is now able to execute multiple commands at the same time.
Timo Sirainen <tss@iki.fi>
parents:
4907
diff
changeset
|
109 pool_t command_pool; |
7639
03146f02403f
Implemented SEARCHRES extension.
Timo Sirainen <tss@iki.fi>
parents:
7635
diff
changeset
|
110 /* New commands are always prepended to the queue */ |
4939
ff2272c228cc
Dovecot is now able to execute multiple commands at the same time.
Timo Sirainen <tss@iki.fi>
parents:
4907
diff
changeset
|
111 struct client_command_context *command_queue; |
ff2272c228cc
Dovecot is now able to execute multiple commands at the same time.
Timo Sirainen <tss@iki.fi>
parents:
4907
diff
changeset
|
112 unsigned int command_queue_size; |
ff2272c228cc
Dovecot is now able to execute multiple commands at the same time.
Timo Sirainen <tss@iki.fi>
parents:
4907
diff
changeset
|
113 |
7815
2d62129a709b
QRESYNC: If MODSEQs were returned in FETCH replies but there are pending
Timo Sirainen <tss@iki.fi>
parents:
7798
diff
changeset
|
114 uint64_t sync_last_full_modseq; |
7817
ffaf1ea49704
QRESYNC: Send HIGHESTMODSEQ automatically in all tagged replies whenever it
Timo Sirainen <tss@iki.fi>
parents:
7816
diff
changeset
|
115 uint64_t highest_fetch_modseq; |
7815
2d62129a709b
QRESYNC: If MODSEQs were returned in FETCH replies but there are pending
Timo Sirainen <tss@iki.fi>
parents:
7798
diff
changeset
|
116 |
7639
03146f02403f
Implemented SEARCHRES extension.
Timo Sirainen <tss@iki.fi>
parents:
7635
diff
changeset
|
117 /* SEARCHRES extension: Last saved SEARCH result */ |
03146f02403f
Implemented SEARCHRES extension.
Timo Sirainen <tss@iki.fi>
parents:
7635
diff
changeset
|
118 ARRAY_TYPE(seq_range) search_saved_uidset; |
7647
879208fdc7e3
Implemented CONTEXT=SEARCH extension.
Timo Sirainen <tss@iki.fi>
parents:
7639
diff
changeset
|
119 /* SEARCH=CONTEXT extension: Searches that get updated */ |
879208fdc7e3
Implemented CONTEXT=SEARCH extension.
Timo Sirainen <tss@iki.fi>
parents:
7639
diff
changeset
|
120 ARRAY_DEFINE(search_updates, struct imap_search_update); |
7639
03146f02403f
Implemented SEARCHRES extension.
Timo Sirainen <tss@iki.fi>
parents:
7635
diff
changeset
|
121 |
4939
ff2272c228cc
Dovecot is now able to execute multiple commands at the same time.
Timo Sirainen <tss@iki.fi>
parents:
4907
diff
changeset
|
122 /* client input/output is locked by this command */ |
ff2272c228cc
Dovecot is now able to execute multiple commands at the same time.
Timo Sirainen <tss@iki.fi>
parents:
4907
diff
changeset
|
123 struct client_command_context *input_lock; |
ff2272c228cc
Dovecot is now able to execute multiple commands at the same time.
Timo Sirainen <tss@iki.fi>
parents:
4907
diff
changeset
|
124 struct client_command_context *output_lock; |
7816
ea6727a1220e
Changed the way mailbox changing ambiguity is checked.
Timo Sirainen <tss@iki.fi>
parents:
7815
diff
changeset
|
125 /* command changing the mailbox */ |
ea6727a1220e
Changed the way mailbox changing ambiguity is checked.
Timo Sirainen <tss@iki.fi>
parents:
7815
diff
changeset
|
126 struct client_command_context *mailbox_change_lock; |
0 | 127 |
7353
33304b5f6070
Syncing supports now calling a callback after sync instead of just sending a
Timo Sirainen <tss@iki.fi>
parents:
7195
diff
changeset
|
128 /* syncing marks this TRUE when it sees \Deleted flags. this is by |
33304b5f6070
Syncing supports now calling a callback after sync instead of just sending a
Timo Sirainen <tss@iki.fi>
parents:
7195
diff
changeset
|
129 EXPUNGE for Outlook-workaround. */ |
33304b5f6070
Syncing supports now calling a callback after sync instead of just sending a
Timo Sirainen <tss@iki.fi>
parents:
7195
diff
changeset
|
130 unsigned int sync_seen_deletes:1; |
7635
19327e95a787
EXPUNGE: Send HIGHESTMODSEQ only if something was actually expunged.
Timo Sirainen <tss@iki.fi>
parents:
7632
diff
changeset
|
131 unsigned int sync_seen_expunges:1; |
4096
904c53275e83
Log a line when IMAP client disconnects with a reason why it happened.
Timo Sirainen <tss@iki.fi>
parents:
3963
diff
changeset
|
132 unsigned int disconnected:1; |
3871
2506e4077e7a
Don't crash if closing with signal while IDLEing.
Timo Sirainen <tss@iki.fi>
parents:
3863
diff
changeset
|
133 unsigned int destroyed:1; |
4939
ff2272c228cc
Dovecot is now able to execute multiple commands at the same time.
Timo Sirainen <tss@iki.fi>
parents:
4907
diff
changeset
|
134 unsigned int handling_input:1; |
5812
71176467310e
Fixes to handling command ambiguity. Don't allow any commands that handle
Timo Sirainen <tss@iki.fi>
parents:
5805
diff
changeset
|
135 unsigned int syncing:1; |
7917
ca2ff54ee9b4
Added support for IMAP ID extension.
Timo Sirainen <tss@iki.fi>
parents:
7817
diff
changeset
|
136 unsigned int id_logged:1; |
8063
f7cbcd15ef2c
imap: Try to allow STORE for read-only mailboxes, but not for EXAMINEd.
Timo Sirainen <tss@iki.fi>
parents:
7927
diff
changeset
|
137 unsigned int mailbox_examined:1; |
764
f57c52738f90
Renamed IBuffer and OBuffer to IStream and OStream which describes their
Timo Sirainen <tss@iki.fi>
parents:
550
diff
changeset
|
138 unsigned int input_skip_line:1; /* skip all the data until we've |
0 | 139 found a new line */ |
7815
2d62129a709b
QRESYNC: If MODSEQs were returned in FETCH replies but there are pending
Timo Sirainen <tss@iki.fi>
parents:
7798
diff
changeset
|
140 unsigned int modseqs_sent_since_sync:1; |
0 | 141 }; |
142 | |
143 /* Create new client with specified input/output handles. socket specifies | |
144 if the handle is a socket. */ | |
8082
db66611fd195
Added struct mail_user and fixed the code to support multiple users per process.
Timo Sirainen <tss@iki.fi>
parents:
8063
diff
changeset
|
145 struct client *client_create(int fd_in, int fd_out, struct mail_user *user); |
4096
904c53275e83
Log a line when IMAP client disconnects with a reason why it happened.
Timo Sirainen <tss@iki.fi>
parents:
3963
diff
changeset
|
146 void client_destroy(struct client *client, const char *reason); |
0 | 147 |
148 /* Disconnect client connection */ | |
4096
904c53275e83
Log a line when IMAP client disconnects with a reason why it happened.
Timo Sirainen <tss@iki.fi>
parents:
3963
diff
changeset
|
149 void client_disconnect(struct client *client, const char *reason); |
1023
dc660f588218
Disconnect client if given non-sync literal size is too large. Better than
Timo Sirainen <tss@iki.fi>
parents:
991
diff
changeset
|
150 void client_disconnect_with_error(struct client *client, const char *msg); |
0 | 151 |
2425
8267d11cacfb
LIST command interrupts itself when output buffer gets full and continues
Timo Sirainen <tss@iki.fi>
parents:
2421
diff
changeset
|
152 /* Send a line of data to client. Returns 1 if ok, 0 if buffer is getting full, |
8267d11cacfb
LIST command interrupts itself when output buffer gets full and continues
Timo Sirainen <tss@iki.fi>
parents:
2421
diff
changeset
|
153 -1 if error */ |
8267d11cacfb
LIST command interrupts itself when output buffer gets full and continues
Timo Sirainen <tss@iki.fi>
parents:
2421
diff
changeset
|
154 int client_send_line(struct client *client, const char *data); |
0 | 155 /* Send line of data to client, prefixed with client->tag */ |
3141
61abed5f7864
Moved command-specific variables from struct client to struct
Timo Sirainen <tss@iki.fi>
parents:
3139
diff
changeset
|
156 void client_send_tagline(struct client_command_context *cmd, const char *data); |
0 | 157 |
158 /* Send BAD command error to client. msg can be NULL. */ | |
3141
61abed5f7864
Moved command-specific variables from struct client to struct
Timo Sirainen <tss@iki.fi>
parents:
3139
diff
changeset
|
159 void client_send_command_error(struct client_command_context *cmd, |
61abed5f7864
Moved command-specific variables from struct client to struct
Timo Sirainen <tss@iki.fi>
parents:
3139
diff
changeset
|
160 const char *msg); |
0 | 161 |
162 /* Read a number of arguments. Returns TRUE if everything was read or | |
3520 | 163 FALSE if either needs more data or error occurred. */ |
3863
55df57c028d4
Added "bool" type and changed all ints that were used as booleans to bool.
Timo Sirainen <tss@iki.fi>
parents:
3811
diff
changeset
|
164 bool client_read_args(struct client_command_context *cmd, unsigned int count, |
5835
d59ed6a31b66
Added more consts to imap-parser API
Timo Sirainen <tss@iki.fi>
parents:
5812
diff
changeset
|
165 unsigned int flags, const struct imap_arg **args_r); |
0 | 166 /* Reads a number of string arguments. ... is a list of pointers where to |
167 store the arguments. */ | |
3863
55df57c028d4
Added "bool" type and changed all ints that were used as booleans to bool.
Timo Sirainen <tss@iki.fi>
parents:
3811
diff
changeset
|
168 bool client_read_string_args(struct client_command_context *cmd, |
55df57c028d4
Added "bool" type and changed all ints that were used as booleans to bool.
Timo Sirainen <tss@iki.fi>
parents:
3811
diff
changeset
|
169 unsigned int count, ...); |
0 | 170 |
7639
03146f02403f
Implemented SEARCHRES extension.
Timo Sirainen <tss@iki.fi>
parents:
7635
diff
changeset
|
171 /* SEARCHRES extension: Call if $ is being used/updated, returns TRUE if we |
03146f02403f
Implemented SEARCHRES extension.
Timo Sirainen <tss@iki.fi>
parents:
7635
diff
changeset
|
172 have to wait for an existing SEARCH SAVE to finish. */ |
03146f02403f
Implemented SEARCHRES extension.
Timo Sirainen <tss@iki.fi>
parents:
7635
diff
changeset
|
173 bool client_handle_search_save_ambiguity(struct client_command_context *cmd); |
03146f02403f
Implemented SEARCHRES extension.
Timo Sirainen <tss@iki.fi>
parents:
7635
diff
changeset
|
174 |
7620 | 175 void client_enable(struct client *client, enum mailbox_feature features); |
176 | |
7647
879208fdc7e3
Implemented CONTEXT=SEARCH extension.
Timo Sirainen <tss@iki.fi>
parents:
7639
diff
changeset
|
177 struct imap_search_update * |
879208fdc7e3
Implemented CONTEXT=SEARCH extension.
Timo Sirainen <tss@iki.fi>
parents:
7639
diff
changeset
|
178 client_search_update_lookup(struct client *client, const char *tag, |
879208fdc7e3
Implemented CONTEXT=SEARCH extension.
Timo Sirainen <tss@iki.fi>
parents:
7639
diff
changeset
|
179 unsigned int *idx_r); |
879208fdc7e3
Implemented CONTEXT=SEARCH extension.
Timo Sirainen <tss@iki.fi>
parents:
7639
diff
changeset
|
180 void client_search_updates_free(struct client *client); |
879208fdc7e3
Implemented CONTEXT=SEARCH extension.
Timo Sirainen <tss@iki.fi>
parents:
7639
diff
changeset
|
181 |
0 | 182 void clients_init(void); |
183 void clients_deinit(void); | |
184 | |
7431
33d8adcc2d44
client_command_free()/cancel(): Take pointer-to-pointer parameter and set it
Timo Sirainen <tss@iki.fi>
parents:
7353
diff
changeset
|
185 void client_command_cancel(struct client_command_context **cmd); |
33d8adcc2d44
client_command_free()/cancel(): Take pointer-to-pointer parameter and set it
Timo Sirainen <tss@iki.fi>
parents:
7353
diff
changeset
|
186 void client_command_free(struct client_command_context **cmd); |
4939
ff2272c228cc
Dovecot is now able to execute multiple commands at the same time.
Timo Sirainen <tss@iki.fi>
parents:
4907
diff
changeset
|
187 |
7103
284dd5f2777d
Use separate idle timeouts to avoid unneededly checking them every n seconds.
Timo Sirainen <tss@iki.fi>
parents:
7057
diff
changeset
|
188 bool client_handle_unfinished_cmd(struct client_command_context *cmd); |
6531
d747bfbda43c
Fixed process hanging sometimes when disconnecting.
Timo Sirainen <tss@iki.fi>
parents:
6418
diff
changeset
|
189 void client_continue_pending_input(struct client **_client); |
5110 | 190 |
6418
46d9ee79f292
Removed _ prefix from all public APIs.
Timo Sirainen <tss@iki.fi>
parents:
6410
diff
changeset
|
191 void client_input(struct client *client); |
7927
2351a81ce699
If commands are pipelined after the login command, pass them to the
Timo Sirainen <tss@iki.fi>
parents:
7917
diff
changeset
|
192 bool client_handle_input(struct client *client); |
6418
46d9ee79f292
Removed _ prefix from all public APIs.
Timo Sirainen <tss@iki.fi>
parents:
6410
diff
changeset
|
193 int client_output(struct client *client); |
1172 | 194 |
0 | 195 #endif |