doveadm-mail-expunge.c revision b932ee7fbbec6e79b777dcc7ba613b9e99f8337b
/* Copyright (c) 2010-2011 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "array.h"
#include "mail-index.h"
#include "mail-storage.h"
#include "mail-search.h"
#include "doveadm-mail-list-iter.h"
#include "doveadm-mail-iter.h"
#include "doveadm-mail.h"
static int
struct mail_search_args *search_args)
{
struct doveadm_mail_iter *iter;
struct mailbox_transaction_context *trans;
return -1;
if (doveadm_debug) {
i_debug("expunge: box=%s uid=%u",
}
}
return doveadm_mail_iter_deinit_sync(&iter);
}
static bool
static bool
{
struct mail_search_arg *arg;
case SEARCH_OR:
return FALSE;
break;
case SEARCH_SUB:
case SEARCH_INTHREAD:
return FALSE;
break;
case SEARCH_MAILBOX:
case SEARCH_MAILBOX_GUID:
case SEARCH_MAILBOX_GLOB:
break;
default:
return FALSE;
}
}
return TRUE;
}
static bool
{
struct mail_search_arg *arg;
/* a) we find one mailbox here in the SUB block */
case SEARCH_MAILBOX:
case SEARCH_MAILBOX_GUID:
case SEARCH_MAILBOX_GLOB:
return TRUE;
case SEARCH_OR:
break;
case SEARCH_SUB:
case SEARCH_INTHREAD:
return TRUE;
break;
default:
break;
}
}
/* b) there is at least one OR block, and all of the ORs must have
mailbox */
if (!have_or)
return FALSE;
return FALSE;
}
return TRUE;
}
static bool
static bool
{
struct mail_search_arg *arg;
/* we're done if all OR branches contain something else besides
MAILBOXes */
case SEARCH_MAILBOX:
case SEARCH_MAILBOX_GUID:
case SEARCH_MAILBOX_GLOB:
return FALSE;
case SEARCH_OR:
return FALSE;
break;
case SEARCH_SUB:
return FALSE;
break;
default:
break;
}
}
return TRUE;
}
static bool
{
struct mail_search_arg *arg;
/* all args can't be just MAILBOXes */
case SEARCH_MAILBOX:
case SEARCH_MAILBOX_GUID:
case SEARCH_MAILBOX_GLOB:
break;
case SEARCH_OR:
/* if each OR branch has something else than just
MAILBOXes, we're ok */
return TRUE;
break;
case SEARCH_SUB:
return TRUE;
break;
default:
return TRUE;
}
}
return FALSE;
}
static void
{
const enum mailbox_list_iter_flags iter_flags =
struct doveadm_mail_list_iter *iter;
const struct mailbox_info *info;
} T_END;
}
{
i_fatal("%s: To avoid accidents, search query "
"must contain MAILBOX in all search branches", cmd);
}
i_fatal("%s: To avoid accidents, each branch in "
"search query must contain something else "
"besides MAILBOX", cmd);
}
}
const char *const args[])
{
doveadm_mail_help_name("expunge");
}
static struct doveadm_mail_cmd_context *cmd_expunge_alloc(void)
{
struct doveadm_mail_cmd_context *ctx;
return ctx;
}
struct doveadm_mail_cmd cmd_expunge = {
};