]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Indicate mail is being autoexpunged
authorAki Tuomi <aki.tuomi@dovecot.fi>
Thu, 23 Mar 2017 12:08:30 +0000 (14:08 +0200)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Thu, 30 Mar 2017 17:53:42 +0000 (20:53 +0300)
This way plugins, such as mail_log, can detect this.

src/lib-storage/mail-autoexpunge.c
src/lib-storage/mail-storage-private.h
src/lib-storage/mail.c

index dbbd2bb969117d5d0dab9a3828ed9d19e0e43457..eec43bb00a4f2e6ba307066773c6973fc4a4cb7b 100644 (file)
@@ -118,7 +118,7 @@ mailbox_autoexpunge(struct mailbox *box, unsigned int interval_time,
                        /* max_mails is still being reached -> expunge.
                           don't even check saved-dates before we're
                           below max_mails. */
-                       mail_expunge(mail);
+                       mail_autoexpunge(mail);
                        count++;
                } else if (interval_time == 0) {
                        /* only max_mails is used. nothing further to do. */
@@ -126,7 +126,7 @@ mailbox_autoexpunge(struct mailbox *box, unsigned int interval_time,
                } else if (mail_get_save_date(mail, &timestamp) == 0) {
                        if (I_MAX(last_rename_stamp, timestamp) > expire_time)
                                break;
-                       mail_expunge(mail);
+                       mail_autoexpunge(mail);
                        count++;
                } else if (mailbox_get_last_mail_error(box) == MAIL_ERROR_EXPUNGED) {
                        /* already expunged */
index 7e7239edb975008ce71786ce80f3e7063568972c..940569c8beb59e742d0697081c13aa08b139c725 100644 (file)
@@ -527,6 +527,8 @@ struct mail_private {
        ARRAY(union mail_module_context *) module_contexts;
 
        const char *get_stream_reason;
+
+       bool autoexpunged:1;
 };
 
 struct mailbox_list_context {
@@ -729,6 +731,9 @@ void mail_storage_copy_list_error(struct mail_storage *storage,
 void mail_storage_copy_error(struct mail_storage *dest,
                             struct mail_storage *src);
 
+/* Indicate mail being expunged by autoexpunge */
+void mail_autoexpunge(struct mail *mail);
+
 /* Returns TRUE if everything should already be in memory after this call
    or if prefetching is not supported, i.e. the caller shouldn't do more
    prefetching before this message is handled. */
index bbb7030de559d54b5f639955999b524e7791429e..2524dc6b2859fc175020567ead6702dc63d51a13 100644 (file)
@@ -412,6 +412,14 @@ void mail_expunge(struct mail *mail)
        } T_END;
 }
 
+void mail_autoexpunge(struct mail *mail)
+{
+       struct mail_private *p = (struct mail_private *)mail;
+       p->autoexpunged = TRUE;
+       mail_expunge(mail);
+       p->autoexpunged = FALSE;
+}
+
 void mail_set_expunged(struct mail *mail)
 {
        mail_storage_set_error(mail->box->storage, MAIL_ERROR_EXPUNGED,