mail->mail.mail.seq = 0;
mail->mail.mail.uid = 0;
mail->mail.seq_pvt = 0;
+ mail->mail.mail_opened_event_sent = FALSE;
mail->mail.mail.expunged = FALSE;
mail->mail.mail.has_nuls = FALSE;
mail->mail.mail.has_no_nuls = FALSE;
bool autoexpunged:1;
/* mail created by mailbox_search_*() */
bool search_mail:1;
+ /* mail_opened event has been sent for this mail/seq */
+ bool mail_opened_event_sent:1;
};
struct mailbox_list_context {
{
struct mail_private *pmail =
container_of(mail, struct mail_private, mail);
+
+ /* If istream is opened twice for the same mail, count it as a single
+ mail_opened event. Their cost is effectively the same, so having
+ two events would just be confusing the statistics. */
+ if (pmail->mail_opened_event_sent)
+ return;
+ pmail->mail_opened_event_sent = TRUE;
+
struct event_passthrough *e =
event_create_passthrough(mail_event(mail))->
set_name("mail_opened")->