doveadm-mail.c revision 94ba4820927b906b333e39445c1508a29387c3aa
/* 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 "module-dir.h"
#include "master-service.h"
#include "mail-user.h"
#include "mail-namespace.h"
#include "mail-storage.h"
#include "mail-storage-settings.h"
#include "mail-storage-service.h"
#include "doveadm.h"
#include "doveadm-settings.h"
#include "doveadm-mail.h"
#include <stdio.h>
#include <stdlib.h>
static int killed_signo = 0;
static void
{
struct mail_namespace *ns;
continue;
}
}
}
static struct mailbox *
{
struct mail_namespace *ns;
const char *orig_mailbox = mailbox;
if (mailbox_open(box) < 0) {
NULL));
}
return box;
}
struct mailbox *
{
NULL));
}
return box;
}
{
struct mail_storage *storage;
doveadm_mail_help_name("force-resync");
}
mailbox_free(&box);
}
static int
struct mail_storage_service_ctx *storage_service,
const struct mail_storage_service_input *input,
{
struct mail_storage_service_user *service_user;
const char *error;
int ret;
&service_user, &error);
if (ret <= 0) {
if (ret < 0) {
error);
}
return ret;
}
&mail_user);
if (ret < 0) {
*error_r = "User init failed";
return ret;
}
return 1;
}
static void
const char *const args[])
{
struct mail_storage_service_ctx *storage_service;
struct mail_storage_service_input input;
const char *error;
int ret;
i_fatal("USER environment is missing and -u option not used");
if (ret < 0)
else if (ret == 0)
i_fatal("User no longer exists");
}
{
}
static void
const char *const args[])
{
struct mail_storage_service_input input;
struct mail_storage_service_ctx *storage_service;
int ret;
n = user_count / 10000;
n /= 10;
user_idx = 0;
&user)) > 0) {
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 *username;
int c;
if (doveadm_debug)
switch (c) {
case 'A':
break;
case 'u':
break;
default:
}
}
if (!all_users) {
(const void *)argv);
} else {
(const void *)argv);
}
}
{
const struct doveadm_mail_cmd *cmd;
return TRUE;
}
}
return FALSE;
}
{
/* for now we'll just assume that cmd will be permanently in memory */
}
void doveadm_mail_usage(void)
{
const struct doveadm_mail_cmd *cmd;
}
}
{
exit(0);
}
void doveadm_mail_help_name(const char *cmd_name)
{
const struct doveadm_mail_cmd *cmd;
}
}
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)
{
}