#ifndef IMAP_PARSER_H
#define IMAP_PARSER_H
#include "imap-arg.h"
enum imap_parser_flags {
/* Set this flag if you wish to read only size of literal argument
and not convert literal into string. Useful when you need to deal
with large literal sizes. The literal must be the last read
parameter. */
/* Don't remove '\' chars from string arguments */
/* Return literals as IMAP_ARG_LITERAL instead of IMAP_ARG_STRING */
/* Don't check if atom contains invalid characters */
/* Allow strings to contain CRLFs */
/* Parse in list context; ')' parses as EOL */
/* Parse literal8 and set it as flag to imap_arg. */
/* We're parsing IMAP server replies. Parse the "text" after
"*" or tag was already skipped over. */
/* Parse until '(' and return it as an empty list */
};
enum imap_parser_error {
/* not fatal */
/* fatal */
};
struct imap_parser;
/* Create new IMAP argument parser. output is used for sending command
continuation requests for literals.
max_line_size can be used to approximately limit the maximum amount of
memory that gets allocated when parsing a line. Input buffer size limits
the maximum size of each parsed token.
Usually the largest lines are large only because they have a one huge
message set token, so you'll probably want to keep input buffer size the
same as max_line_size. That means the maximum memory usage is around
2 * max_line_size. */
struct imap_parser *
/* Enable LITERAL- parser semantics: non-synchronizing literals must not
exceed 4096 bytes */
/* Reset the parser to initial state. */
/* Change parser's input and output streams */
/* Return the last error in parser. fatal is set to TRUE if there's no way to
continue parsing, currently only if too large non-sync literal size was
given. */
/* Read a number of arguments. This function doesn't call i_stream_read(), you
need to do that. Returns number of arguments read (may be less than count
in case of EOL), -2 if more data is needed or -1 if error occurred.
count-sized array of arguments are stored into args when return value is
0 or larger. If all arguments weren't read, they're set to NIL. count
can be set to 0 to read all arguments in the line. Last element in
args is always of type IMAP_ARG_EOL. */
enum imap_parser_flags flags,
/* If parsing ended with literal size, return it. */
/* IMAP_PARSE_FLAG_LITERAL_SIZE is set and last read argument was a literal.
Calling this function causes the literal size to be replaced with the actual
literal data when continuing argument parsing. */
/* just like imap_parser_read_args(), but assume \n at end of data in
input stream. */
enum imap_parser_flags flags,
/* Read one word - used for reading tag and command name.
Returns NULL if more data is needed. */
#endif