From: Timo Sirainen Date: Mon, 29 Nov 2021 14:36:58 +0000 (+0100) Subject: lib-storage: Move struct mail.event to mail_private X-Git-Tag: 2.3.18~52 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=58eef6713e650cd724add706c6d086d15c548ee9;p=thirdparty%2Fdovecot%2Fcore.git lib-storage: Move struct mail.event to mail_private --- diff --git a/src/lib-storage/index/index-mail.c b/src/lib-storage/index/index-mail.c index 9902cd148c..ff2ed246ca 100644 --- a/src/lib-storage/index/index-mail.c +++ b/src/lib-storage/index/index-mail.c @@ -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); } diff --git a/src/lib-storage/mail-storage-private.h b/src/lib-storage/mail-storage-private.h index 63af167bf7..a809b44ad3 100644 --- a/src/lib-storage/mail-storage-private.h +++ b/src/lib-storage/mail-storage-private.h @@ -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; diff --git a/src/lib-storage/mail-storage.h b/src/lib-storage/mail-storage.h index 2b9cf05d23..17e724359e 100644 --- a/src/lib-storage/mail-storage.h +++ b/src/lib-storage/mail-storage.h @@ -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; diff --git a/src/lib-storage/mail.c b/src/lib-storage/mail.c index 252680542e..720349fc8e 100644 --- a/src/lib-storage/mail.c +++ b/src/lib-storage/mail.c @@ -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)