/* Copyright (c) 2013-2018 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 {
bool by_msgid;
};
{
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) {
i_error("Searching mailbox '%s' failed: %s",
ret = -1;
}
if (mailbox_transaction_commit(&trans) < 0) {
i_error("Committing mailbox '%s' transaction failed: %s",
ret = -1;
}
return ret;
}
static int
const struct mailbox_info *info,
struct mail_search_args *search_args)
{
(struct deduplicate_cmd_context *)_ctx;
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) {
T_BEGIN {
ret = -1;
} T_END;
}
}
pool_unref(&pool);
if (mailbox_sync(box, 0) < 0) {
i_error("Syncing mailbox '%s' failed: %s",
ret = -1;
}
mailbox_free(&box);
return ret;
}
static int
{
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;
switch (c) {
case 'm':
break;
default:
return FALSE;
}
return TRUE;
}
{
}
.name = "deduplicate",
};