]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Move struct mail.event to mail_private
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 29 Nov 2021 14:36:58 +0000 (15:36 +0100)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Tue, 21 Dec 2021 10:06:58 +0000 (10:06 +0000)
src/lib-storage/index/index-mail.c
src/lib-storage/mail-storage-private.h
src/lib-storage/mail-storage.h
src/lib-storage/mail.c

index 9902cd148cf0e727c0639ba2be1ac404f24290d4..ff2ed246ca27ea52d8b3642677f88bd0a29f907c 100644 (file)
@@ -1755,8 +1755,10 @@ index_mail_alloc(struct mailbox_transaction_context *t,
 
 static void index_mail_init_event(struct mail *mail)
 {
-       mail->event = event_create(mail->box->event);
-       event_add_category(mail->event, &event_category_mail);
+       struct mail_private *p = (struct mail_private *)mail;
+
+       p->_event = event_create(mail->box->event);
+       event_add_category(p->_event, &event_category_mail);
 }
 
 void index_mail_init(struct index_mail *mail,
@@ -1885,7 +1887,7 @@ void index_mail_close(struct mail *_mail)
 
        /* make sure old mail isn't visible in the event anymore even if it's
           attempted to be used. */
-       event_unref(&_mail->event);
+       event_unref(&mail->mail._event);
 
        /* If uid == 0 but seq != 0, we came here from saving a (non-mbox)
           message. If that happens, don't bother checking if anything should
@@ -2162,15 +2164,15 @@ void index_mail_set_seq(struct mail *_mail, uint32_t seq, bool saving)
 
        /* Recreate the mail event when changing mails. Even though the same
           mail struct is reused, they are practically different mails. */
-       event_unref(&_mail->event);
+       event_unref(&mail->mail._event);
        index_mail_init_event(_mail);
-       event_add_int(_mail->event, "seq", _mail->seq);
-       event_add_int(_mail->event, "uid", _mail->uid);
+       event_add_int(mail->mail._event, "seq", _mail->seq);
+       event_add_int(mail->mail._event, "uid", _mail->uid);
        /* Add mail age field to event. */
        if (index_mail_get_age_days(_mail, &age_days))
-               event_add_int(_mail->event, "mail_age_days", age_days);
+               event_add_int(mail->mail._event, "mail_age_days", age_days);
 
-       event_set_append_log_prefix(_mail->event, t_strdup_printf(
+       event_set_append_log_prefix(mail->mail._event, t_strdup_printf(
                "%sUID %u: ", saving ? "saving " : "", _mail->uid));
 
        if (mail_index_view_is_inconsistent(_mail->transaction->view)) {
@@ -2313,7 +2315,7 @@ void index_mail_free(struct mail *_mail)
 
        mailbox_header_lookup_unref(&mail->data.wanted_headers);
        mailbox_header_lookup_unref(&mail->mail.wanted_headers);
-       event_unref(&_mail->event);
+       event_unref(&mail->mail._event);
        pool_unref(&mail->mail.data_pool);
        pool_unref(&mail->mail.pool);
 }
index 63af167bf7bb6d12c4baeee302d9605444dddfb5..a809b44ad370b2a39ff571469ea3701348bb3e1c 100644 (file)
@@ -578,6 +578,7 @@ struct mail_private {
           allows mail_log plugin to log the copy operation using the original
           mailbox name. */
        struct mail *vmail;
+       struct event *_event;
 
        uint32_t seq_pvt;
 
index 2b9cf05d23ae57ace9596de9d5273d45c85b26e5..17e724359e226722584a0fdac95b709bd4eb09d2 100644 (file)
@@ -398,7 +398,6 @@ struct mail {
        /* always set */
        struct mailbox *box;
        struct mailbox_transaction_context *transaction;
-       struct event *event;
        uint32_t seq, uid;
 
        bool expunged:1;
index 252680542e5dbfbd0aab2942c73f9f54f6008134..720349fc8ec095f3490229d37e4e4d04828e4a9c 100644 (file)
@@ -101,7 +101,9 @@ void mail_add_temp_wanted_fields(struct mail *mail,
 
 struct event *mail_event(struct mail *mail)
 {
-       return mail->event;
+       struct mail_private *p = (struct mail_private *)mail;
+
+       return p->_event;
 }
 
 enum mail_flags mail_get_flags(struct mail *mail)