Mercurial > dovecot > original-hg > dovecot-1.2
annotate src/imap/commands.h @ 8728:da19acbae79e HEAD
imap: export imap_commands array containing all registered commands.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Fri, 06 Feb 2009 13:38:26 -0500 |
parents | ca2ff54ee9b4 |
children | ef7c0c3b1976 |
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 | |
c4342385d696
If client tries to change the selected mailbox state while another command
Timo Sirainen <tss@iki.fi>
parents:
6418
diff
changeset
|
23 COMMAND_FLAG_USES_SEQS |
4941
f612d2086448
If running commands in parallel would cause ambiguity, run them
Timo Sirainen <tss@iki.fi>
parents:
4939
diff
changeset
|
24 }; |
f612d2086448
If running commands in parallel would cause ambiguity, run them
Timo Sirainen <tss@iki.fi>
parents:
4939
diff
changeset
|
25 |
1464
bd489d13479e
Added command_register() and related functions so we can dynamically
Timo Sirainen <tss@iki.fi>
parents:
1244
diff
changeset
|
26 struct command { |
bd489d13479e
Added command_register() and related functions so we can dynamically
Timo Sirainen <tss@iki.fi>
parents:
1244
diff
changeset
|
27 const char *name; |
bd489d13479e
Added command_register() and related functions so we can dynamically
Timo Sirainen <tss@iki.fi>
parents:
1244
diff
changeset
|
28 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
|
29 |
f612d2086448
If running commands in parallel would cause ambiguity, run them
Timo Sirainen <tss@iki.fi>
parents:
4939
diff
changeset
|
30 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
|
31 }; |
8728
da19acbae79e
imap: export imap_commands array containing all registered commands.
Timo Sirainen <tss@iki.fi>
parents:
7917
diff
changeset
|
32 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
|
33 |
da19acbae79e
imap: export imap_commands array containing all registered commands.
Timo Sirainen <tss@iki.fi>
parents:
7917
diff
changeset
|
34 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
|
35 |
bd489d13479e
Added command_register() and related functions so we can dynamically
Timo Sirainen <tss@iki.fi>
parents:
1244
diff
changeset
|
36 /* 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
|
37 command is unregistered. */ |
5568
cce4074b7876
Added command flags parameter to command_register()
Timo Sirainen <tss@iki.fi>
parents:
4941
diff
changeset
|
38 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
|
39 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
|
40 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
|
41 |
bd489d13479e
Added command_register() and related functions so we can dynamically
Timo Sirainen <tss@iki.fi>
parents:
1244
diff
changeset
|
42 /* Register array of commands. */ |
4629
0d24ee6b4ccd
Use array_t in commands buffer.
Timo Sirainen <tss@iki.fi>
parents:
4313
diff
changeset
|
43 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
|
44 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
|
45 |
4941
f612d2086448
If running commands in parallel would cause ambiguity, run them
Timo Sirainen <tss@iki.fi>
parents:
4939
diff
changeset
|
46 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
|
47 |
bd489d13479e
Added command_register() and related functions so we can dynamically
Timo Sirainen <tss@iki.fi>
parents:
1244
diff
changeset
|
48 void commands_init(void); |
bd489d13479e
Added command_register() and related functions so we can dynamically
Timo Sirainen <tss@iki.fi>
parents:
1244
diff
changeset
|
49 void commands_deinit(void); |
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 /* IMAP4rev1 commands: */ |
0 | 52 |
53 /* 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
|
54 bool cmd_logout(struct client_command_context *cmd); |
0 | 55 |
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
|
56 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
|
57 bool cmd_noop(struct client_command_context *cmd); |
0 | 58 |
59 /* 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
|
60 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
|
61 bool cmd_examine(struct client_command_context *cmd); |
0 | 62 |
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_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
|
64 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
|
65 bool cmd_rename(struct client_command_context *cmd); |
0 | 66 |
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
|
67 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
|
68 bool cmd_unsubscribe(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_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
|
71 bool cmd_lsub(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_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
|
74 bool cmd_append(struct client_command_context *cmd); |
0 | 75 |
76 /* 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
|
77 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
|
78 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
|
79 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
|
80 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
|
81 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
|
82 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
|
83 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
|
84 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
|
85 |
bd489d13479e
Added command_register() and related functions so we can dynamically
Timo Sirainen <tss@iki.fi>
parents:
1244
diff
changeset
|
86 /* IMAP extensions: */ |
7647
879208fdc7e3
Implemented CONTEXT=SEARCH extension.
Timo Sirainen <tss@iki.fi>
parents:
7621
diff
changeset
|
87 bool cmd_cancelupdate(struct client_command_context *cmd); |
7621
bec7141872eb
Added support for ENABLE extension.
Timo Sirainen <tss@iki.fi>
parents:
6418
diff
changeset
|
88 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
|
89 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
|
90 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
|
91 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
|
92 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
|
93 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
|
94 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
|
95 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
|
96 bool cmd_x_cancel(struct client_command_context *cmd); |
0 | 97 |
699
cc795d74d08f
Use more warnings with GCC by default. Fixed several warnings.
Timo Sirainen <tss@iki.fi>
parents:
0
diff
changeset
|
98 /* private: */ |
6418
46d9ee79f292
Removed _ prefix from all public APIs.
Timo Sirainen <tss@iki.fi>
parents:
6410
diff
changeset
|
99 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
|
100 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
|
101 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
|
102 |
0 | 103 #endif |