dovecot-2.1: doveadm expunge -d: If mailbox is deleted, unsubscr...
dovecot at dovecot.org
dovecot at dovecot.org
Tue Apr 24 21:13:03 EEST 2012
details: http://hg.dovecot.org/dovecot-2.1/rev/b1653b7bd165
changeset: 14473:b1653b7bd165
user: Timo Sirainen <tss at iki.fi>
date: Tue Apr 24 21:12:36 2012 +0300
description:
doveadm expunge -d: If mailbox is deleted, unsubscribe it also
diffstat:
src/doveadm/doveadm-mail-expunge.c | 24 +++++++++++++-----------
1 files changed, 13 insertions(+), 11 deletions(-)
diffs (52 lines):
diff -r dd3798681283 -r b1653b7bd165 src/doveadm/doveadm-mail-expunge.c
--- a/src/doveadm/doveadm-mail-expunge.c Tue Apr 24 21:09:25 2012 +0300
+++ b/src/doveadm/doveadm-mail-expunge.c Tue Apr 24 21:12:36 2012 +0300
@@ -25,6 +25,7 @@
struct mailbox_transaction_context *trans;
struct mail *mail;
enum mail_error error;
+ int ret = 0;
if (doveadm_mail_iter_init(_ctx, info, search_args, 0, NULL,
&trans, &iter) < 0)
@@ -38,28 +39,29 @@
mail_expunge(mail);
}
- if (doveadm_mail_iter_deinit_keep_box(&iter, &box) < 0) {
- mailbox_free(&box);
- return -1;
- }
- if (mailbox_sync(box, 0) < 0) {
+ if (doveadm_mail_iter_deinit_keep_box(&iter, &box) < 0)
+ ret = -1;
+ else if (mailbox_sync(box, 0) < 0) {
doveadm_mail_failed_mailbox(_ctx, box);
- mailbox_free(&box);
- return -1;
+ ret = -1;
}
- if (ctx->delete_empty_mailbox) {
+ if (ctx->delete_empty_mailbox && ret == 0) {
if (mailbox_delete_empty(box) < 0) {
(void)mailbox_get_last_error(box, &error);
if (error != MAIL_ERROR_EXISTS) {
doveadm_mail_failed_mailbox(_ctx, box);
- mailbox_free(&box);
- return -1;
+ ret = -1;
+ }
+ } else {
+ if (mailbox_set_subscribed(box, FALSE) < 0) {
+ doveadm_mail_failed_mailbox(_ctx, box);
+ ret = -1;
}
}
}
mailbox_free(&box);
- return 0;
+ return ret;
}
static bool
More information about the dovecot-cvs
mailing list