]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Always set struct mail.expunged
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 29 Apr 2021 12:39:29 +0000 (15:39 +0300)
committerTimo Sirainen <timo.sirainen@open-xchange.com>
Wed, 5 May 2021 14:22:04 +0000 (17:22 +0300)
Previously it was set only when some error noticed that there was a problem
accessing the mail. Now this is set immediately in mail_set_seq(). This
allows e.g. IMAP COPY/MOVE to abort when it encounters expunged mails.

src/lib-storage/index/index-mail.c

index 01237ec236adbac0f4ea8d486070158a900a73e2..37abde321b3b811395714013b184a6ccd5fcac7c 100644 (file)
@@ -2150,6 +2150,11 @@ void index_mail_set_seq(struct mail *_mail, uint32_t seq, bool saving)
                mail_set_expunged(&mail->mail.mail);
                return;
        }
+       /* Allow callers to easily find out if this mail was already expunged
+          by another session. It's possible that it could still be
+          successfully accessed. */
+       if (mail_index_is_expunged(_mail->transaction->view, seq))
+               mail_set_expunged(&mail->mail.mail);
 
        if (!mail->mail.search_mail) {
                index_mail_update_access_parts_pre(_mail);