changeset 14866:fc521e6378d5

lazy_expunge: Allow expunging from lazy_expunge namespace via virtual mailbox. (Instead of copying the message all over again to the lazy_expunge namespace.)
author Timo Sirainen <tss@iki.fi>
date Sat, 05 Jan 2013 00:12:54 +0200
parents c91d142130be
children 3eeb5270963b
files src/plugins/lazy-expunge/lazy-expunge-plugin.c
diffstat 1 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugins/lazy-expunge/lazy-expunge-plugin.c	Fri Jan 04 23:59:42 2013 +0200
+++ b/src/plugins/lazy-expunge/lazy-expunge-plugin.c	Sat Jan 05 00:12:54 2013 +0200
@@ -121,9 +121,20 @@
 	union mail_module_context *mmail = LAZY_EXPUNGE_MAIL_CONTEXT(mail);
 	struct lazy_expunge_transaction *lt =
 		LAZY_EXPUNGE_CONTEXT(_mail->transaction);
+	struct lazy_expunge_mailbox_list *llist;
+	struct mailbox *real_box;
 	struct mail_save_context *save_ctx;
 	const char *error;
 
+	/* don't copy the mail if we're expunging from lazy_expunge
+	   namespace (even if it's via a virtual mailbox) */
+	real_box = mail_get_real_mail(_mail)->box;
+	llist = LAZY_EXPUNGE_LIST_CONTEXT(real_box->list);
+	if (llist != NULL && llist->internal_namespace) {
+		mmail->super.expunge(_mail);
+		return;
+	}
+
 	if (lt->dest_box == NULL) {
 		lt->dest_box = mailbox_open_or_create(luser->lazy_ns->list,
 						      _mail->box, &error);