doveadm-mail.h revision b932ee7fbbec6e79b777dcc7ba613b9e99f8337b
#ifndef DOVEADM_MAIL_H
#define DOVEADM_MAIL_H
#include <stdio.h>
#include "doveadm-util.h"
#include "module-context.h"
struct mailbox;
struct mail_user;
struct mail_storage_service_ctx;
struct mail_storage_service_input;
struct mail_storage_service_user;
struct doveadm_mail_cmd_context;
struct doveadm_mail_cmd_vfuncs {
const char *const args[]);
const char **username_r);
};
struct doveadm_mail_cmd_module_register {
unsigned int id;
};
union doveadm_mail_cmd_module_context {
struct doveadm_mail_cmd_vfuncs super;
struct doveadm_mail_cmd_module_register *reg;
};
struct doveadm_mail_cmd_context {
const struct doveadm_mail_cmd *cmd;
const char *const *args;
const char *getopt_args;
struct mail_storage_service_ctx *storage_service;
/* search args aren't set for all mail commands */
struct mail_search_args *search_args;
struct mail_user *cur_mail_user;
struct doveadm_mail_cmd_vfuncs v;
/* We're handling only a single user */
unsigned int iterate_single_user:1;
/* We're going through all users (not set for wildcard usernames) */
unsigned int iterate_all_users:1;
unsigned int failed:1;
};
struct doveadm_mail_cmd {
struct doveadm_mail_cmd_context *(*alloc)(void);
const char *name;
const char *usage_args;
};
extern struct doveadm_mail_cmd_module_register doveadm_mail_cmd_module_register;
void doveadm_mail_try_help_name(const char *cmd_name);
bool doveadm_mail_has_subcommands(const char *cmd_name);
void doveadm_mail_init(void);
void doveadm_mail_deinit(void);
struct doveadm_mail_cmd_context *
struct mail_storage_service_user *user,
const char **error_r);
void doveadm_mail_server_flush(void);
struct mail_search_args *
doveadm_mail_build_search_args(const char *const args[]);
const char *const *doveadm_mailbox_args_to_mutf7(const char *const args[]);
struct mail_search_args *
doveadm_mail_mailbox_search_args_build(const char *const args[]);
struct doveadm_mail_cmd_context *
#define doveadm_mail_cmd_alloc(type) \
struct doveadm_mail_cmd cmd_expunge;
struct doveadm_mail_cmd cmd_search;
struct doveadm_mail_cmd cmd_fetch;
struct doveadm_mail_cmd cmd_import;
struct doveadm_mail_cmd cmd_altmove;
struct doveadm_mail_cmd cmd_move;
struct doveadm_mail_cmd cmd_mailbox_list;
struct doveadm_mail_cmd cmd_mailbox_create;
struct doveadm_mail_cmd cmd_mailbox_delete;
struct doveadm_mail_cmd cmd_mailbox_rename;
struct doveadm_mail_cmd cmd_mailbox_status;
#endif