1
#ifndef MAIL_SEARCH_PARSER_H
2
#define MAIL_SEARCH_PARSER_H
4
#define MAIL_SEARCH_PARSER_KEY_LIST "("
8
/* Build a parser parsing the given imap args. NOTE: args must not be freed
9
until this parser is destroyed. */
10
struct mail_search_parser *
11
mail_search_parser_init_imap(const struct imap_arg *args);
12
/* Build a parser parsing the given command line args. */
13
struct mail_search_parser *
14
mail_search_parser_init_cmdline(const char *const args[]);
16
void mail_search_parser_deinit(struct mail_search_parser **parser);
18
/* Key is set to the next search key, or MAIL_SEARCH_PARSER_KEY_LIST for
19
beginning of a list. Returns 1 if ok, 0 if no more keys in this
20
list/query, -1 if parsing error. */
21
int mail_search_parse_key(struct mail_search_parser *parser,
23
/* Get the next string. Returns 0 if ok, -1 if parsing error. */
24
int mail_search_parse_string(struct mail_search_parser *parser,
25
const char **value_r);
26
/* If next parameter equals to the given string case-insensitively, skip over
27
it and return TRUE. Otherwise do nothing and return FALSE. */
28
bool mail_search_parse_skip_next(struct mail_search_parser *parser,
31
/* Returns the reason string for parsing error. */
32
const char *mail_search_parser_get_error(struct mail_search_parser *parser);