doveadm-mail-deduplicate.c revision bb25bed75eefd011138ebf1b8e033fc8ef55ca74
/* Copyright (c) 2013-2015 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "hash.h"
#include "mail-storage.h"
#include "mail-search-build.h"
#include "doveadm-mailbox-list-iter.h"
#include "doveadm-mail-iter.h"
#include "doveadm-mail.h"
struct uidlist {
};
struct deduplicate_cmd_context {
struct doveadm_mail_cmd_context ctx;
bool by_msgid;
};
{
struct mailbox_transaction_context *trans;
struct mail_search_context *search_ctx;
struct mail_search_args *search_args;
struct mail_search_arg *arg;
int ret = 0;
/* the uidlist is reversed with oldest mails at the end.
we'll delete everything but the oldest mail. */
return 0;
if (mailbox_search_deinit(&search_ctx) < 0) {
ret = -1;
}
if (mailbox_transaction_commit(&trans) < 0) {
ret = -1;
}
return ret;
}
static int
const struct mailbox_info *info,
struct mail_search_args *search_args)
{
struct deduplicate_cmd_context *ctx =
(struct deduplicate_cmd_context *)_ctx;
struct doveadm_mail_iter *iter;
enum mail_error error;
int ret = 0;
&iter) < 0)
return -1;
if (error == MAIL_ERROR_NOTFOUND)
continue;
i_error("Couldn't lookup Message-ID: for UID=%u: %s",
ret = -1;
break;
}
} else {
if (error == MAIL_ERROR_NOTFOUND)
continue;
i_error("Couldn't lookup GUID: for UID=%u: %s",
ret = -1;
break;
}
}
} else {
}
}
}
ret = -1;
if (ret == 0) {
struct hash_iterate_context *iter;
T_BEGIN {
ret = -1;
} T_END;
}
}
pool_unref(&pool);
if (mailbox_sync(box, 0) < 0) {
ret = -1;
}
mailbox_free(&box);
return ret;
}
static int
{
const enum mailbox_list_iter_flags iter_flags =
struct doveadm_mailbox_list_iter *iter;
const struct mailbox_info *info;
int ret = 0;
ret = -1;
} T_END;
if (doveadm_mailbox_list_iter_deinit(&iter) < 0)
ret = -1;
return ret;
}
const char *const args[])
{
doveadm_mail_help_name("deduplicate");
}
static bool
{
struct deduplicate_cmd_context *ctx =
(struct deduplicate_cmd_context *)_ctx;
switch (c) {
case 'm':
break;
default:
return FALSE;
}
return TRUE;
}
static struct doveadm_mail_cmd_context *cmd_deduplicate_alloc(void)
{
struct deduplicate_cmd_context *ctx;
}
struct doveadm_mail_cmd cmd_deduplicate = {
};