From: Timo Sirainen Date: Thu, 29 Apr 2021 12:39:29 +0000 (+0300) Subject: lib-storage: Always set struct mail.expunged X-Git-Tag: 2.3.16~223 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=91ba53a4a0da4703cab35b8041e6d53ce797f3b5;p=thirdparty%2Fdovecot%2Fcore.git lib-storage: Always set struct mail.expunged 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. --- diff --git a/src/lib-storage/index/index-mail.c b/src/lib-storage/index/index-mail.c index 01237ec236..37abde321b 100644 --- a/src/lib-storage/index/index-mail.c +++ b/src/lib-storage/index/index-mail.c @@ -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);