/* Force opening mailbox and ignoring any ACLs */
MAILBOX_FLAG_IGNORE_ACLS = 0x100,
/* Open mailbox even if it's already marked as deleted */
- MAILBOX_FLAG_OPEN_DELETED = 0x200
+ MAILBOX_FLAG_OPEN_DELETED = 0x200,
+ /* Mailbox is opened for deletion, which should be performed as
+ efficiently as possible, even allowing the mailbox state to become
+ inconsistent. For example this disables lazy_expunge plugin and
+ quota updates (possibly resulting in broken quota). and This is
+ useful for example when deleting entire user accounts. */
+ MAILBOX_FLAG_DELETE_UNSAFE = 0x400
};
enum mailbox_feature {
union mailbox_module_context *mbox;
struct mailbox_vfuncs *v = box->vlast;
- if (llist == NULL)
+ if (llist == NULL || (box->flags & MAILBOX_FLAG_DELETE_UNSAFE) != 0)
return;
mbox = p_new(box->pool, union mailbox_module_context, 1);
if (qbox->module_ctx.super.sync_notify != NULL)
qbox->module_ctx.super.sync_notify(box, uid, sync_type);
- if (sync_type != MAILBOX_SYNC_TYPE_EXPUNGE || qbox->recalculate) {
+ if (sync_type != MAILBOX_SYNC_TYPE_EXPUNGE || qbox->recalculate ||
+ (box->flags & MAILBOX_FLAG_DELETE_UNSAFE) != 0) {
if (uid == 0) {
/* free the transaction before view syncing begins,
otherwise it'll crash. */