doveadm-mail.c revision 4f79049854ca6a69453deb5487f2b722fdae3e35
/* Copyright (c) 2009-2010 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "array.h"
#include "lib-signals.h"
#include "ioloop.h"
#include "str.h"
#include "module-dir.h"
#include "wildcard-match.h"
#include "master-service.h"
#include "imap-utf7.h"
#include "mail-user.h"
#include "mail-namespace.h"
#include "mail-storage.h"
#include "mail-storage-settings.h"
#include "mail-storage-service.h"
#include "mail-search-build.h"
#include "mail-search-parser.h"
#include "doveadm.h"
#include "doveadm-settings.h"
#include "doveadm-print.h"
#include "doveadm-mail.h"
#include <stdio.h>
#include <stdlib.h>
doveadm_mail_cmd_module_register = { 0 };
static int killed_signo = 0;
struct doveadm_mail_cmd_context *
{
struct doveadm_mail_cmd_context *ctx;
return ctx;
}
static void
{
struct mail_namespace *ns;
continue;
}
}
}
static struct doveadm_mail_cmd_context *cmd_purge_alloc(void)
{
struct doveadm_mail_cmd_context *ctx;
return ctx;
}
{
struct mail_namespace *ns;
const char *orig_mailbox = mailbox;
if (mailbox_open(box) < 0) {
NULL));
mailbox_free(&box);
return -1;
}
return 0;
}
{
return -1;
NULL));
return -1;
}
return 0;
}
struct mail_search_args *
doveadm_mail_build_search_args(const char *const args[])
{
struct mail_search_parser *parser;
struct mail_search_args *sargs;
const char *error;
return sargs;
}
struct force_resync_cmd_context {
struct doveadm_mail_cmd_context ctx;
const char *mailbox;
};
{
struct force_resync_cmd_context *ctx =
(struct force_resync_cmd_context *)_ctx;
struct mail_storage *storage;
return;
}
i_error("Forcing a resync on mailbox %s failed: %s",
}
mailbox_free(&box);
}
const char *const args[])
{
struct force_resync_cmd_context *ctx =
(struct force_resync_cmd_context *)_ctx;
doveadm_mail_help_name("force-resync");
}
static struct doveadm_mail_cmd_context *cmd_force_resync_alloc(void)
{
struct force_resync_cmd_context *ctx;
}
static int
const struct mail_storage_service_input *input,
const char **error_r)
{
struct mail_storage_service_user *service_user;
const char *error;
int ret;
&service_user, &error);
if (ret <= 0) {
if (ret < 0) {
error);
}
return ret;
}
&ctx->cur_mail_user);
if (ret < 0) {
*error_r = "User init failed";
return ret;
}
return 1;
}
static void
const char *username,
{
struct mail_storage_service_input input;
const char *error;
int ret;
i_fatal("USER environment is missing and -u option not used");
if (hook_doveadm_mail_init != NULL)
if (ret < 0)
else if (ret == 0)
i_fatal("User no longer exists");
}
{
}
static void
const char *wildcard_user,
{
struct mail_storage_service_input input;
int ret;
if (hook_doveadm_mail_init != NULL)
n = user_count / 10000;
n /= 10;
user_idx = 0;
if (wildcard_user != NULL) {
continue;
}
T_BEGIN {
if (ret < 0)
else if (ret == 0)
i_info("User no longer exists, skipping");
} T_END;
if (ret == -1)
break;
if (doveadm_verbose) {
}
}
if (killed_signo != 0) {
ret = -1;
break;
}
}
if (doveadm_verbose)
printf("\n");
i_set_failure_prefix("doveadm: ");
if (ret < 0)
i_error("Failed to iterate through some users");
}
static void
const char *const args[] ATTR_UNUSED)
{
}
static int
const char **username_r)
{
}
static void
{
}
static void
{
struct doveadm_mail_cmd_context *ctx;
int c;
if (doveadm_debug)
switch (c) {
case 'A':
if (doveadm_print_is_initialized()) {
}
break;
case 'u':
break;
default:
}
}
i_fatal("doveadm %s: Unknown parameter: %s",
}
} else {
}
}
static bool
{
unsigned int len;
if (argc < 2)
return FALSE;
return FALSE;
/* more args */
}
return FALSE;
/* match */
return TRUE;
}
{
const struct doveadm_mail_cmd *cmd;
unsigned int cmd_name_len;
return TRUE;
}
/* see if it matches a multi-word command */
return TRUE;
}
}
return FALSE;
}
{
/* for now we'll just assume that cmd will be permanently in memory */
}
{
const struct doveadm_mail_cmd *cmd;
}
}
{
exit(0);
}
void doveadm_mail_try_help_name(const char *cmd_name)
{
const struct doveadm_mail_cmd *cmd;
}
}
bool doveadm_mail_has_subcommands(const char *cmd_name)
{
const struct doveadm_mail_cmd *cmd;
return TRUE;
}
return FALSE;
}
void doveadm_mail_help_name(const char *cmd_name)
{
}
static struct doveadm_mail_cmd cmd_force_resync = {
};
static struct doveadm_mail_cmd cmd_purge = {
};
static struct doveadm_mail_cmd *mail_commands[] = {
};
void doveadm_mail_init(void)
{
struct module_dir_load_settings mod_set;
unsigned int i;
for (i = 0; i < N_ELEMENTS(mail_commands); i++)
/* load all configured mail plugins */
&mod_set);
}
void doveadm_mail_deinit(void)
{
}