imap-fetch.h revision d10a370b2614712d9cb6a1dd8625f62a071b6377
#ifndef IMAP_FETCH_H
#define IMAP_FETCH_H
struct imap_fetch_context;
enum imap_fetch_handler_flags {
IMAP_FETCH_HANDLER_FLAG_BUFFERED = 0x01,
};
/* Returns 1 = ok, 0 = client output buffer full, call again, -1 = error.
mail = NULL for deinit. */
struct imap_fetch_init_context {
struct imap_fetch_context *fetch_ctx;
const char *name;
const char *error;
};
struct imap_fetch_handler {
const char *name;
/* Returns FALSE and sets ctx->error if arg is invalid */
};
struct imap_fetch_context_handler {
void *context;
const char *name;
const char *nil_reply;
unsigned int buffered:1;
unsigned int want_deinit:1;
};
struct imap_fetch_state {
struct mailbox_transaction_context *trans;
struct mail_search_context *search_ctx;
unsigned int cur_handler;
const char *cur_human_name;
bool skip_cr;
unsigned int seen_flags_changed:1;
unsigned int cur_first:1;
unsigned int line_partial:1;
unsigned int line_finished:1;
unsigned int skipped_expunged_msgs:1;
unsigned int failed:1;
};
struct imap_fetch_context {
struct mail_search_args *search_args;
enum mail_fetch_field fetch_data;
unsigned int buffered_handlers_count;
struct imap_fetch_state state;
unsigned int flags_have_handler:1;
unsigned int flags_update_seen:1;
unsigned int flags_show_only_seen_changes:1;
unsigned int send_vanished:1;
};
const char *nil_reply,
#ifdef CONTEXT_TYPE_SAFETY
#else
#endif
struct imap_fetch_context *
bool (*init)(struct imap_fetch_init_context *));
struct client_command_context *cmd,
struct client_command_context *cmd);
void imap_fetch_handlers_init(void);
void imap_fetch_handlers_deinit(void);
#endif