doveadm-mail.h revision 62d0db14d2c5008758983c28d242ec158baabf9e
#ifndef DOVEADM_MAIL_H
#define DOVEADM_MAIL_H
#include <stdio.h>
#include "doveadm.h"
#include "doveadm-util.h"
#include "module-context.h"
#include "mail-storage-service.h"
enum mail_error;
struct mailbox;
struct mail_storage;
struct mail_user;
struct doveadm_mail_cmd_context;
struct doveadm_mail_cmd_vfuncs {
const char *const args[]);
const char **username_r);
struct mail_storage_service_user *service_user,
const char **error_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;
/* args including -options */
const char *const *full_args;
const char *getopt_args;
const struct doveadm_settings *set;
struct mail_storage_service_ctx *storage_service;
/* search args aren't set for all mail commands */
struct mail_search_args *search_args;
const char *cur_username;
struct mail_user *cur_mail_user;
struct doveadm_mail_cmd_vfuncs v;
/* if non-zero, exit with this code */
int exit_code;
/* 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;
};
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;
extern char doveadm_mail_cmd_hide;
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 *
const struct doveadm_settings *set);
const struct mail_storage_service_input *input);
const struct mail_storage_service_input *input,
const char **error_r);
void doveadm_mail_server_flush(void);
struct mailbox *
struct mail_search_args *
doveadm_mail_build_search_args(const char *const args[]);
void doveadm_mailbox_args_check(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) \
enum mail_error error);
struct mail_storage *storage);
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_index;
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