1
1
#ifndef IMAP_SEARCH_H
2
2
#define IMAP_SEARCH_H
6
struct client_command_context;
8
/* Builds search arguments based on IMAP arguments. */
9
struct mail_search_arg *
10
imap_search_args_build(pool_t pool, struct mailbox *box,
11
const struct imap_arg *args, const char **error_r);
12
/* Free allocated keywords */
13
void imap_search_args_free(struct mailbox *box, struct mail_search_arg *args);
15
struct mail_search_arg *
16
imap_search_get_arg(struct client_command_context *cmd,
17
const char *set, bool uid);
6
enum search_return_options {
7
SEARCH_RETURN_ESEARCH = 0x0001,
8
SEARCH_RETURN_MIN = 0x0002,
9
SEARCH_RETURN_MAX = 0x0004,
10
SEARCH_RETURN_ALL = 0x0008,
11
SEARCH_RETURN_COUNT = 0x0010,
12
SEARCH_RETURN_MODSEQ = 0x0020,
13
SEARCH_RETURN_SAVE = 0x0040,
14
SEARCH_RETURN_UPDATE = 0x0080,
15
SEARCH_RETURN_PARTIAL = 0x0100
16
/* Options that don't return any seq/uid results */
17
#define SEARCH_RETURN_NORESULTS \
18
(SEARCH_RETURN_ESEARCH | SEARCH_RETURN_MODSEQ | SEARCH_RETURN_SAVE | \
22
struct imap_search_context {
23
struct client_command_context *cmd;
25
struct mailbox_transaction_context *trans;
26
struct mail_search_context *search_ctx;
29
struct mail_search_args *sargs;
30
enum search_return_options return_options;
31
uint32_t partial1, partial2;
34
ARRAY_TYPE(seq_range) result;
35
unsigned int result_count;
37
uint64_t highest_seen_modseq;
38
struct timeval start_time;
40
unsigned int have_seqsets:1;
41
unsigned int have_modseqs:1;
42
unsigned int sorting:1;
45
int cmd_search_parse_return_if_found(struct imap_search_context *ctx,
46
const struct imap_arg **args);
48
bool imap_search_start(struct imap_search_context *ctx,
49
struct mail_search_args *sargs,
50
const enum mail_sort_type *sort_program);