imapc-client.h revision 56d1345c43bbd28c36b7faa85e4163bd9e874290
#ifndef IMAPC_CLIENT_H
#define IMAPC_CLIENT_H
/* IMAP RFC defines this to be at least 30 minutes. */
enum imapc_command_state {
};
enum imapc_capability {
IMAPC_CAPABILITY_SASL_IR = 0x01,
IMAPC_CAPABILITY_LITERALPLUS = 0x02,
IMAPC_CAPABILITY_QRESYNC = 0x04,
IMAPC_CAPABILITY_IDLE = 0x08,
IMAPC_CAPABILITY_UIDPLUS = 0x10,
IMAPC_CAPABILITY_AUTH_PLAIN = 0x20,
IMAPC_CAPABILITY_STARTTLS = 0x40,
IMAPC_CAPABILITY_X_GM_EXT_1 = 0x80,
IMAPC_CAPABILITY_CONDSTORE = 0x100,
IMAPC_CAPABILITY_NAMESPACE = 0x200,
IMAPC_CAPABILITY_IMAP4REV1 = 0x40000000
};
struct imapc_capability_name {
const char *name;
enum imapc_capability capability;
};
extern const struct imapc_capability_name imapc_capability_names[];
enum imapc_command_flags {
/* The command changes the selected mailbox (SELECT, EXAMINE) */
IMAPC_COMMAND_FLAG_SELECT = 0x01,
/* The command is sent to server before login (or is the login
command itself). Non-prelogin commands will be queued until login
is successful. */
IMAPC_COMMAND_FLAG_PRELOGIN = 0x02,
/* Allow command to be automatically retried if disconnected before it
finishes. */
IMAPC_COMMAND_FLAG_RETRIABLE = 0x04
};
enum imapc_client_ssl_mode {
};
struct imapc_client_settings {
const char *host;
unsigned int port;
const char *master_user;
const char *username;
const char *password;
unsigned int max_idle_time;
const char *dns_client_socket_path;
const char *temp_path_prefix;
const char *ssl_ca_dir, *ssl_ca_file;
bool ssl_verify;
const char *rawlog_dir;
const char *ssl_crypto_device;
bool debug;
};
struct imapc_command_reply {
enum imapc_command_state state;
/* "[RESP TEXT]" produces key=RESP, value=TEXT.
"[RESP]" produces key=RESP, value=NULL
otherwise both are NULL */
const char *resp_text_key, *resp_text_value;
/* The full tagged reply, including [RESP TEXT]. */
const char *text_full;
/* Tagged reply text without [RESP TEXT] */
const char *text_without_resp;
};
struct imapc_arg_file {
/* file descriptor containing the value */
int fd;
/* parent_arg.list[list_idx] points to the IMAP_ARG_LITERAL_SIZE
argument */
const struct imap_arg *parent_arg;
unsigned int list_idx;
};
struct imapc_untagged_reply {
/* name of the untagged reply, e.g. EXISTS */
const char *name;
/* number at the beginning of the reply, or 0 if there wasn't any.
Set for EXISTS, EXPUNGE, etc. */
/* the rest of the reply can be read from these args. */
/* arguments whose contents are stored into files. only
"FETCH (BODY[" arguments can be here. */
const struct imapc_arg_file *file_args;
unsigned int file_args_count;
/* "* OK [RESP TEXT]" produces key=RESP, value=TEXT.
"* OK [RESP]" produces key=RESP, value=NULL
otherwise both are NULL */
const char *resp_text_key, *resp_text_value;
/* If this reply occurred while a mailbox was selected, this contains
the mailbox's untagged_context. */
void *untagged_box_context;
};
/* Called when tagged reply is received for command. */
void *context);
/* Called each time untagged input is received. */
void *context);
struct imapc_client *
/* Explicitly login to server (also done automatically). */
struct imapc_command *
enum imapc_command_flags flags);
void *context);
struct imapc_client_mailbox *
void *untagged_box_context);
void *context);
struct imapc_command *
struct imapc_msgmap *
enum imapc_capability
const char **path_r);
#endif