imap-client.h revision 08406452bf0deae412437463618ed3f870ed03d5
854b4074ac77a138b3983d72510b4d8779d15040Timo Sirainen/* Maximum number of CONTEXT=SEARCH UPDATEs. Clients probably won't need more
854b4074ac77a138b3983d72510b4d8779d15040Timo Sirainen than a few, so this is mainly to avoid more or less accidental pointless
854b4074ac77a138b3983d72510b4d8779d15040Timo Sirainen resource usage. */
854b4074ac77a138b3983d72510b4d8779d15040Timo Sirainen /* All keyword names. The array itself exists in mail_index.
854b4074ac77a138b3983d72510b4d8779d15040Timo Sirainen Keywords are currently only appended, they're never removed. */
854b4074ac77a138b3983d72510b4d8779d15040Timo Sirainen /* Number of keywords announced to client via FLAGS/PERMANENTFLAGS.
854b4074ac77a138b3983d72510b4d8779d15040Timo Sirainen This relies on keywords not being removed while mailbox is
854b4074ac77a138b3983d72510b4d8779d15040Timo Sirainen /* Waiting for more input */
854b4074ac77a138b3983d72510b4d8779d15040Timo Sirainen /* Waiting to be able to send more output */
854b4074ac77a138b3983d72510b4d8779d15040Timo Sirainen /* Waiting for external interaction */
854b4074ac77a138b3983d72510b4d8779d15040Timo Sirainen /* Wait for other commands to finish execution */
854b4074ac77a138b3983d72510b4d8779d15040Timo Sirainen /* Waiting for other commands to finish so we can sync */
854b4074ac77a138b3983d72510b4d8779d15040Timo Sirainen /* Command is finished */
854b4074ac77a138b3983d72510b4d8779d15040Timo Sirainen /* time when command handling was started - typically this is after
854b4074ac77a138b3983d72510b4d8779d15040Timo Sirainen reading all the parameters. */
854b4074ac77a138b3983d72510b4d8779d15040Timo Sirainen /* time when command handling was last finished. this is before
854b4074ac77a138b3983d72510b4d8779d15040Timo Sirainen mailbox syncing is done. */
854b4074ac77a138b3983d72510b4d8779d15040Timo Sirainen /* io_loop_get_wait_usecs()'s value when the command was started */
854b4074ac77a138b3983d72510b4d8779d15040Timo Sirainen /* how many usecs this command itself has spent running */
854b4074ac77a138b3983d72510b4d8779d15040Timo Sirainen /* how many usecs this command itself has spent waiting for locks */
854b4074ac77a138b3983d72510b4d8779d15040Timo Sirainen /* how many bytes of client input/output command has used */
decdff03c32cb5d0e99d71c5678fd008714de70bTimo Sirainen /* IMAP command tag */
decdff03c32cb5d0e99d71c5678fd008714de70bTimo Sirainen const char *tag;
decdff03c32cb5d0e99d71c5678fd008714de70bTimo Sirainen /* Name of this command */
854b4074ac77a138b3983d72510b4d8779d15040Timo Sirainen /* Parameters for this command. These are generated from parsed IMAP
854b4074ac77a138b3983d72510b4d8779d15040Timo Sirainen arguments, so they may not be exactly the same as how client sent
854b4074ac77a138b3983d72510b4d8779d15040Timo Sirainen /* Parameters for this command generated with
854b4074ac77a138b3983d72510b4d8779d15040Timo Sirainen imap_write_args_for_human(), so it's suitable for logging. */
854b4074ac77a138b3983d72510b4d8779d15040Timo Sirainen /* Module-specific contexts. */
854b4074ac77a138b3983d72510b4d8779d15040Timo Sirainen ARRAY(union imap_module_context *) module_contexts;
854b4074ac77a138b3983d72510b4d8779d15040Timo Sirainen struct client_command_stats_start stats_start;
854b4074ac77a138b3983d72510b4d8779d15040Timo Sirainen bool cancel:1; /* command is wanted to be cancelled */
854b4074ac77a138b3983d72510b4d8779d15040Timo Sirainen bool search_save_result:1; /* search result is being updated */
854b4074ac77a138b3983d72510b4d8779d15040Timo Sirainen bool search_save_result_used:1; /* command uses search save */
854b4074ac77a138b3983d72510b4d8779d15040Timo Sirainen bool temp_executed:1; /* temporary execution state tracking */
854b4074ac77a138b3983d72510b4d8779d15040Timo Sirainen /* Export client state into buffer. Returns 1 if ok, 0 if some state
decdff03c32cb5d0e99d71c5678fd008714de70bTimo Sirainen couldn't be preserved, -1 if temporary internal error occurred. */
854b4074ac77a138b3983d72510b4d8779d15040Timo Sirainen int (*state_export)(struct client *client, bool internal,
854b4074ac77a138b3983d72510b4d8779d15040Timo Sirainen /* Import a single block of client state from the given data. Returns
854b4074ac77a138b3983d72510b4d8779d15040Timo Sirainen number of bytes successfully imported from the block, or 0 if state
854b4074ac77a138b3983d72510b4d8779d15040Timo Sirainen is corrupted or contains unknown data (e.g. some plugin is no longer
854b4074ac77a138b3983d72510b4d8779d15040Timo Sirainen loaded), -1 if temporary internal error occurred. */
854b4074ac77a138b3983d72510b4d8779d15040Timo Sirainen ssize_t (*state_import)(struct client *client, bool internal,
854b4074ac77a138b3983d72510b4d8779d15040Timo Sirainen const char **error_r);
854b4074ac77a138b3983d72510b4d8779d15040Timo Sirainen void (*destroy)(struct client *client, const char *reason);
const char *data);
struct client {
struct imap_client_vfuncs v;
const char *session_id;
unsigned int sync_counter;
unsigned int bad_counter;
unsigned int command_queue_size;
char *last_cmd_name;
struct imap_module_register {
unsigned int id;
union imap_module_context {
extern unsigned int imap_client_count;
const char *msg);
unsigned int count, ...);
struct imap_search_update *
unsigned int *idx_r);