dovecot-2.2: lib-storage: Added mailbox_move(), which is basical...
dovecot at dovecot.org
dovecot at dovecot.org
Wed Jun 20 06:22:14 EEST 2012
details: http://hg.dovecot.org/dovecot-2.2/rev/8d596b5adbab
changeset: 14613:8d596b5adbab
user: Timo Sirainen <tss at iki.fi>
date: Wed Jun 20 06:15:46 2012 +0300
description:
lib-storage: Added mailbox_move(), which is basically copy+expunge.
diffstat:
src/lib-storage/mail-storage-private.h | 2 ++
src/lib-storage/mail-storage.c | 12 ++++++++++++
src/lib-storage/mail-storage.h | 3 +++
3 files changed, 17 insertions(+), 0 deletions(-)
diffs (47 lines):
diff -r 347c2ca867b7 -r 8d596b5adbab src/lib-storage/mail-storage-private.h
--- a/src/lib-storage/mail-storage-private.h Wed Jun 20 06:09:04 2012 +0300
+++ b/src/lib-storage/mail-storage-private.h Wed Jun 20 06:15:46 2012 +0300
@@ -470,6 +470,8 @@
unsigned int copying_via_save:1;
/* mail is being saved, not copied */
unsigned int saving:1;
+ /* mail is being moved - ignore quota */
+ unsigned int moving:1;
};
struct mailbox_sync_context {
diff -r 347c2ca867b7 -r 8d596b5adbab src/lib-storage/mail-storage.c
--- a/src/lib-storage/mail-storage.c Wed Jun 20 06:09:04 2012 +0300
+++ b/src/lib-storage/mail-storage.c Wed Jun 20 06:15:46 2012 +0300
@@ -1711,6 +1711,18 @@
return ret;
}
+int mailbox_move(struct mail_save_context **_ctx, struct mail *mail)
+{
+ struct mail_save_context *ctx = *_ctx;
+
+ ctx->moving = TRUE;
+ if (mailbox_copy(_ctx, mail) < 0)
+ return -1;
+
+ mail_expunge(mail);
+ return 0;
+}
+
int mailbox_save_using_mail(struct mail_save_context **ctx, struct mail *mail)
{
(*ctx)->saving = TRUE;
diff -r 347c2ca867b7 -r 8d596b5adbab src/lib-storage/mail-storage.h
--- a/src/lib-storage/mail-storage.h Wed Jun 20 06:09:04 2012 +0300
+++ b/src/lib-storage/mail-storage.h Wed Jun 20 06:15:46 2012 +0300
@@ -679,6 +679,9 @@
/* Copy the given message. You'll need to specify the flags etc. using the
mailbox_save_*() functions. */
int mailbox_copy(struct mail_save_context **ctx, struct mail *mail);
+/* Move the given message. This is usually equivalent to copy+expunge,
+ but without enforcing quota. */
+int mailbox_move(struct mail_save_context **ctx, struct mail *mail);
/* Same as mailbox_copy(), but treat the message as if it's being saved,
not copied. (For example: New mail delivered to multiple maildirs, with
each mails being hard link copies.) */
More information about the dovecot-cvs
mailing list