dovecot-2.0: doveadm altmove: Sync all mailboxes after moving ma...
dovecot at dovecot.org
dovecot at dovecot.org
Tue Jun 29 21:04:42 EEST 2010
details: http://hg.dovecot.org/dovecot-2.0/rev/077fb09819e2
changeset: 11655:077fb09819e2
user: Timo Sirainen <tss at iki.fi>
date: Tue Jun 29 19:04:20 2010 +0100
description:
doveadm altmove: Sync all mailboxes after moving mails.
diffstat:
src/doveadm/doveadm-mail-altmove.c | 2 +-
src/doveadm/doveadm-mail-iter.c | 15 ++++++++++++++-
src/doveadm/doveadm-mail-iter.h | 1 +
3 files changed, 16 insertions(+), 2 deletions(-)
diffs (60 lines):
diff -r 2167bea550e1 -r 077fb09819e2 src/doveadm/doveadm-mail-altmove.c
--- a/src/doveadm/doveadm-mail-altmove.c Tue Jun 29 18:29:18 2010 +0100
+++ b/src/doveadm/doveadm-mail-altmove.c Tue Jun 29 19:04:20 2010 +0100
@@ -30,7 +30,7 @@
MAIL_INDEX_MAIL_FLAG_BACKEND);
}
mail_free(&mail);
- return doveadm_mail_iter_deinit(&iter);
+ return doveadm_mail_iter_deinit_sync(&iter);
}
static void ns_purge(struct mail_namespace *ns)
diff -r 2167bea550e1 -r 077fb09819e2 src/doveadm/doveadm-mail-iter.c
--- a/src/doveadm/doveadm-mail-iter.c Tue Jun 29 18:29:18 2010 +0100
+++ b/src/doveadm/doveadm-mail-iter.c Tue Jun 29 19:04:20 2010 +0100
@@ -70,7 +70,8 @@
return ret;
}
-int doveadm_mail_iter_deinit(struct doveadm_mail_iter **_iter)
+static int
+doveadm_mail_iter_deinit_full(struct doveadm_mail_iter **_iter, bool sync)
{
struct doveadm_mail_iter *iter = *_iter;
int ret;
@@ -78,11 +79,23 @@
*_iter = NULL;
ret = doveadm_mail_iter_deinit_transaction(iter);
+ if (ret == 0 && sync)
+ ret = mailbox_sync(iter->box, 0);
mailbox_free(&iter->box);
i_free(iter);
return ret;
}
+int doveadm_mail_iter_deinit(struct doveadm_mail_iter **_iter)
+{
+ return doveadm_mail_iter_deinit_full(_iter, FALSE);
+}
+
+int doveadm_mail_iter_deinit_sync(struct doveadm_mail_iter **_iter)
+{
+ return doveadm_mail_iter_deinit_full(_iter, TRUE);
+}
+
bool doveadm_mail_iter_next(struct doveadm_mail_iter *iter, struct mail *mail)
{
return mailbox_search_next(iter->search_ctx, mail);
diff -r 2167bea550e1 -r 077fb09819e2 src/doveadm/doveadm-mail-iter.h
--- a/src/doveadm/doveadm-mail-iter.h Tue Jun 29 18:29:18 2010 +0100
+++ b/src/doveadm/doveadm-mail-iter.h Tue Jun 29 19:04:20 2010 +0100
@@ -8,6 +8,7 @@
struct mailbox_transaction_context **trans_r,
struct doveadm_mail_iter **iter_r);
int doveadm_mail_iter_deinit(struct doveadm_mail_iter **iter);
+int doveadm_mail_iter_deinit_sync(struct doveadm_mail_iter **iter);
bool doveadm_mail_iter_next(struct doveadm_mail_iter *iter, struct mail *mail);
More information about the dovecot-cvs
mailing list