]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lazy_expunge: Allow expunging from lazy_expunge namespace via virtual mailbox.
authorTimo Sirainen <tss@iki.fi>
Fri, 4 Jan 2013 22:12:54 +0000 (00:12 +0200)
committerTimo Sirainen <tss@iki.fi>
Fri, 4 Jan 2013 22:12:54 +0000 (00:12 +0200)
(Instead of copying the message all over again to the lazy_expunge
namespace.)

src/plugins/lazy-expunge/lazy-expunge-plugin.c

index 2cb02cd397080eebfa96c4adc654b9e53979f54c..4cda2813d045ae482d58905f0f4611ad9f3a10c1 100644 (file)
@@ -121,9 +121,20 @@ static void lazy_expunge_mail_expunge(struct mail *_mail)
        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);