Mercurial > dovecot > original-hg > dovecot-1.2
annotate src/imap/commands.h @ 9354:687ac828b964 HEAD
lib-index: modseqs weren't tracked properly within session when changes were done.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Tue, 01 Sep 2009 13:05:03 -0400 |
parents | ef7c0c3b1976 |
children | 3efdbaab2960 |
rev | line source |
---|---|
6410
e4eb71ae8e96
Changed .h ifdef/defines to use <NAME>_H format.
Timo Sirainen <tss@iki.fi>
parents:
5568
diff
changeset
|
1 #ifndef COMMANDS_H |
e4eb71ae8e96
Changed .h ifdef/defines to use <NAME>_H format.
Timo Sirainen <tss@iki.fi>
parents:
5568
diff
changeset
|
2 #define COMMANDS_H |
0 | 3 |
3141
61abed5f7864
Moved command-specific variables from struct client to struct
Timo Sirainen <tss@iki.fi>
parents:
3139
diff
changeset
|
4 struct client_command_context; |
3139 | 5 |
1041 | 6 #include "mail-storage.h" |
7 #include "imap-parser.h" | |
2427
e1616067df5c
Syncing works now too without buffering everything. Also fixed handling
Timo Sirainen <tss@iki.fi>
parents:
2190
diff
changeset
|
8 #include "imap-sync.h" |
0 | 9 #include "commands-util.h" |
10 | |
3863
55df57c028d4
Added "bool" type and changed all ints that were used as booleans to bool.
Timo Sirainen <tss@iki.fi>
parents:
3141
diff
changeset
|
11 typedef bool command_func_t(struct client_command_context *cmd); |
3139 | 12 |
4941
f612d2086448
If running commands in parallel would cause ambiguity, run them
Timo Sirainen <tss@iki.fi>
parents:
4939
diff
changeset
|
13 enum command_flags { |
f612d2086448
If running commands in parallel would cause ambiguity, run them
Timo Sirainen <tss@iki.fi>
parents:
4939
diff
changeset
|
14 /* Command uses sequences as its input parameters */ |
f612d2086448
If running commands in parallel would cause ambiguity, run them
Timo Sirainen <tss@iki.fi>
parents:
4939
diff
changeset
|
15 COMMAND_FLAG_USES_SEQS = 0x01, |
f612d2086448
If running commands in parallel would cause ambiguity, run them
Timo Sirainen <tss@iki.fi>
parents:
4939
diff
changeset
|
16 /* Command may reply with EXPUNGE, causing sequences to break */ |
f612d2086448
If running commands in parallel would cause ambiguity, run them
Timo Sirainen <tss@iki.fi>
parents:
4939
diff
changeset
|
17 COMMAND_FLAG_BREAKS_SEQS = 0x02, |
f612d2086448
If running commands in parallel would cause ambiguity, run them
Timo Sirainen <tss@iki.fi>
parents:
4939
diff
changeset
|
18 /* Command changes the mailbox */ |
7524
c4342385d696
If client tries to change the selected mailbox state while another command
Timo Sirainen <tss@iki.fi>
parents:
6418
diff
changeset
|
19 COMMAND_FLAG_BREAKS_MAILBOX = 0x04 | COMMAND_FLAG_BREAKS_SEQS, |
c4342385d696
If client tries to change the selected mailbox state while another command
Timo Sirainen <tss@iki.fi>
parents:
6418
diff
changeset
|
20 |
c4342385d696
If client tries to change the selected mailbox state while another command
Timo Sirainen <tss@iki.fi>
parents:
6418
diff
changeset
|
21 /* Command uses selected mailbox */ |
c4342385d696
If client tries to change the selected mailbox state while another command
Timo Sirainen <tss@iki.fi>
parents:
6418
diff
changeset
|
22 COMMAND_FLAG_USES_MAILBOX = COMMAND_FLAG_BREAKS_MAILBOX | |
9136
ef7c0c3b1976
IMAP: Don't crash if IDLE command is pipelined after a long-running UID FETCH or UID SEARCH.
Timo Sirainen <tss@iki.fi>
parents:
8728
diff
changeset
|
23 COMMAND_FLAG_USES_SEQS, |
ef7c0c3b1976
IMAP: Don't crash if IDLE command is pipelined after a long-running UID FETCH or UID SEARCH.
Timo Sirainen <tss@iki.fi>
parents:
8728
diff
changeset
|
24 |
ef7c0c3b1976
IMAP: Don't crash if IDLE command is pipelined after a long-running UID FETCH or UID SEARCH.
Timo Sirainen <tss@iki.fi>
parents:
8728
diff
changeset
|
25 /* Command requires mailbox syncing before it can do its job. */ |
ef7c0c3b1976
IMAP: Don't crash if IDLE command is pipelined after a long-running UID FETCH or UID SEARCH.
Timo Sirainen <tss@iki.fi>
parents:
8728
diff
changeset
|
26 COMMAND_FLAG_REQUIRES_SYNC = 0x08 |
4941
f612d2086448
If running commands in parallel would cause ambiguity, run them
Timo Sirainen <tss@iki.fi>
parents:
4939
diff
changeset
|
27 }; |
f612d2086448
If running commands in parallel would cause ambiguity, run them
Timo Sirainen <tss@iki.fi>
parents:
4939
diff
changeset
|
28 |
1464
bd489d13479e
Added command_register() and related functions so we can dynamically
Timo Sirainen <tss@iki.fi>
parents:
1244
diff
changeset
|
29 struct command { |
bd489d13479e
Added command_register() and related functions so we can dynamically
Timo Sirainen <tss@iki.fi>
parents:
1244
diff
changeset
|
30 const char *name; |
bd489d13479e
Added command_register() and related functions so we can dynamically
Timo Sirainen <tss@iki.fi>
parents:
1244
diff
changeset
|
31 command_func_t *func; |
4941
f612d2086448
If running commands in parallel would cause ambiguity, run them
Timo Sirainen <tss@iki.fi>
parents:
4939
diff
changeset
|
32 |
f612d2086448
If running commands in parallel would cause ambiguity, run them
Timo Sirainen <tss@iki.fi>
parents:
4939
diff
changeset
|
33 enum command_flags flags; |
1464
bd489d13479e
Added command_register() and related functions so we can dynamically
Timo Sirainen <tss@iki.fi>
parents:
1244
diff
changeset
|
34 }; |
8728
da19acbae79e
imap: export imap_commands array containing all registered commands.
Timo Sirainen <tss@iki.fi>
parents:
7917
diff
changeset
|
35 ARRAY_DEFINE_TYPE(command, struct command); |
da19acbae79e
imap: export imap_commands array containing all registered commands.
Timo Sirainen <tss@iki.fi>
parents:
7917
diff
changeset
|
36 |
da19acbae79e
imap: export imap_commands array containing all registered commands.
Timo Sirainen <tss@iki.fi>
parents:
7917
diff
changeset
|
37 extern ARRAY_TYPE(command) imap_commands; |
1464
bd489d13479e
Added command_register() and related functions so we can dynamically
Timo Sirainen <tss@iki.fi>
parents:
1244
diff
changeset
|
38 |
bd489d13479e
Added command_register() and related functions so we can dynamically
Timo Sirainen <tss@iki.fi>
parents:
1244
diff
changeset
|
39 /* Register command. Given name parameter must be permanently stored until |
bd489d13479e
Added command_register() and related functions so we can dynamically
Timo Sirainen <tss@iki.fi>
parents:
1244
diff
changeset
|
40 command is unregistered. */ |
5568
cce4074b7876
Added command flags parameter to command_register()
Timo Sirainen <tss@iki.fi>
parents:
4941
diff
changeset
|
41 void command_register(const char *name, command_func_t *func, |
cce4074b7876
Added command flags parameter to command_register()
Timo Sirainen <tss@iki.fi>
parents:
4941
diff
changeset
|
42 enum command_flags flags); |
1464
bd489d13479e
Added command_register() and related functions so we can dynamically
Timo Sirainen <tss@iki.fi>
parents:
1244
diff
changeset
|
43 void command_unregister(const char *name); |
bd489d13479e
Added command_register() and related functions so we can dynamically
Timo Sirainen <tss@iki.fi>
parents:
1244
diff
changeset
|
44 |
bd489d13479e
Added command_register() and related functions so we can dynamically
Timo Sirainen <tss@iki.fi>
parents:
1244
diff
changeset
|
45 /* Register array of commands. */ |
4629
0d24ee6b4ccd
Use array_t in commands buffer.
Timo Sirainen <tss@iki.fi>
parents:
4313
diff
changeset
|
46 void command_register_array(const struct command *cmdarr, unsigned int count); |
0d24ee6b4ccd
Use array_t in commands buffer.
Timo Sirainen <tss@iki.fi>
parents:
4313
diff
changeset
|
47 void command_unregister_array(const struct command *cmdarr, unsigned int count); |
1464
bd489d13479e
Added command_register() and related functions so we can dynamically
Timo Sirainen <tss@iki.fi>
parents:
1244
diff
changeset
|
48 |
4941
f612d2086448
If running commands in parallel would cause ambiguity, run them
Timo Sirainen <tss@iki.fi>
parents:
4939
diff
changeset
|
49 struct command *command_find(const char *name); |
1464
bd489d13479e
Added command_register() and related functions so we can dynamically
Timo Sirainen <tss@iki.fi>
parents:
1244
diff
changeset
|
50 |
bd489d13479e
Added command_register() and related functions so we can dynamically
Timo Sirainen <tss@iki.fi>
parents:
1244
diff
changeset
|
51 void commands_init(void); |
bd489d13479e
Added command_register() and related functions so we can dynamically
Timo Sirainen <tss@iki.fi>
parents:
1244
diff
changeset
|
52 void commands_deinit(void); |
bd489d13479e
Added command_register() and related functions so we can dynamically
Timo Sirainen <tss@iki.fi>
parents:
1244
diff
changeset
|
53 |
bd489d13479e
Added command_register() and related functions so we can dynamically
Timo Sirainen <tss@iki.fi>
parents:
1244
diff
changeset
|
54 /* IMAP4rev1 commands: */ |
0 | 55 |
56 /* Non-Authenticated State */ | |
3863
55df57c028d4
Added "bool" type and changed all ints that were used as booleans to bool.
Timo Sirainen <tss@iki.fi>
parents:
3141
diff
changeset
|
57 bool cmd_logout(struct client_command_context *cmd); |
0 | 58 |
3863
55df57c028d4
Added "bool" type and changed all ints that were used as booleans to bool.
Timo Sirainen <tss@iki.fi>
parents:
3141
diff
changeset
|
59 bool cmd_capability(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:
3141
diff
changeset
|
60 bool cmd_noop(struct client_command_context *cmd); |
0 | 61 |
62 /* Authenticated State */ | |
3863
55df57c028d4
Added "bool" type and changed all ints that were used as booleans to bool.
Timo Sirainen <tss@iki.fi>
parents:
3141
diff
changeset
|
63 bool cmd_select(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:
3141
diff
changeset
|
64 bool cmd_examine(struct client_command_context *cmd); |
0 | 65 |
3863
55df57c028d4
Added "bool" type and changed all ints that were used as booleans to bool.
Timo Sirainen <tss@iki.fi>
parents:
3141
diff
changeset
|
66 bool cmd_create(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:
3141
diff
changeset
|
67 bool cmd_delete(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:
3141
diff
changeset
|
68 bool cmd_rename(struct client_command_context *cmd); |
0 | 69 |
3863
55df57c028d4
Added "bool" type and changed all ints that were used as booleans to bool.
Timo Sirainen <tss@iki.fi>
parents:
3141
diff
changeset
|
70 bool cmd_subscribe(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:
3141
diff
changeset
|
71 bool cmd_unsubscribe(struct client_command_context *cmd); |
0 | 72 |
3863
55df57c028d4
Added "bool" type and changed all ints that were used as booleans to bool.
Timo Sirainen <tss@iki.fi>
parents:
3141
diff
changeset
|
73 bool cmd_list(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:
3141
diff
changeset
|
74 bool cmd_lsub(struct client_command_context *cmd); |
0 | 75 |
3863
55df57c028d4
Added "bool" type and changed all ints that were used as booleans to bool.
Timo Sirainen <tss@iki.fi>
parents:
3141
diff
changeset
|
76 bool cmd_status(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:
3141
diff
changeset
|
77 bool cmd_append(struct client_command_context *cmd); |
0 | 78 |
79 /* Selected state */ | |
3863
55df57c028d4
Added "bool" type and changed all ints that were used as booleans to bool.
Timo Sirainen <tss@iki.fi>
parents:
3141
diff
changeset
|
80 bool cmd_check(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:
3141
diff
changeset
|
81 bool cmd_close(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:
3141
diff
changeset
|
82 bool cmd_expunge(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:
3141
diff
changeset
|
83 bool cmd_search(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:
3141
diff
changeset
|
84 bool cmd_fetch(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:
3141
diff
changeset
|
85 bool cmd_store(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:
3141
diff
changeset
|
86 bool cmd_copy(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:
3141
diff
changeset
|
87 bool cmd_uid(struct client_command_context *cmd); |
1464
bd489d13479e
Added command_register() and related functions so we can dynamically
Timo Sirainen <tss@iki.fi>
parents:
1244
diff
changeset
|
88 |
bd489d13479e
Added command_register() and related functions so we can dynamically
Timo Sirainen <tss@iki.fi>
parents:
1244
diff
changeset
|
89 /* IMAP extensions: */ |
7647
879208fdc7e3
Implemented CONTEXT=SEARCH extension.
Timo Sirainen <tss@iki.fi>
parents:
7621
diff
changeset
|
90 bool cmd_cancelupdate(struct client_command_context *cmd); |
7621
bec7141872eb
Added support for ENABLE extension.
Timo Sirainen <tss@iki.fi>
parents:
6418
diff
changeset
|
91 bool cmd_enable(struct client_command_context *cmd); |
7917
ca2ff54ee9b4
Added support for IMAP ID extension.
Timo Sirainen <tss@iki.fi>
parents:
7798
diff
changeset
|
92 bool cmd_id(struct client_command_context *cmd); |
3863
55df57c028d4
Added "bool" type and changed all ints that were used as booleans to bool.
Timo Sirainen <tss@iki.fi>
parents:
3141
diff
changeset
|
93 bool cmd_idle(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:
3141
diff
changeset
|
94 bool cmd_namespace(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:
3141
diff
changeset
|
95 bool cmd_sort(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:
3141
diff
changeset
|
96 bool cmd_thread(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:
3141
diff
changeset
|
97 bool cmd_uid_expunge(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:
3141
diff
changeset
|
98 bool cmd_unselect(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:
4629
diff
changeset
|
99 bool cmd_x_cancel(struct client_command_context *cmd); |
0 | 100 |
699
cc795d74d08f
Use more warnings with GCC by default. Fixed several warnings.
Timo Sirainen <tss@iki.fi>
parents:
0
diff
changeset
|
101 /* private: */ |
6418
46d9ee79f292
Removed _ prefix from all public APIs.
Timo Sirainen <tss@iki.fi>
parents:
6410
diff
changeset
|
102 bool cmd_list_full(struct client_command_context *cmd, bool lsub); |
46d9ee79f292
Removed _ prefix from all public APIs.
Timo Sirainen <tss@iki.fi>
parents:
6410
diff
changeset
|
103 bool cmd_select_full(struct client_command_context *cmd, bool readonly); |
46d9ee79f292
Removed _ prefix from all public APIs.
Timo Sirainen <tss@iki.fi>
parents:
6410
diff
changeset
|
104 bool cmd_subscribe_full(struct client_command_context *cmd, bool subscribe); |
699
cc795d74d08f
Use more warnings with GCC by default. Fixed several warnings.
Timo Sirainen <tss@iki.fi>
parents:
0
diff
changeset
|
105 |
0 | 106 #endif |