bool has_nuls, body_size_from_stream = FALSE;
int ret;
- if (mail->mail.get_stream_reason != NULL &&
- mail->mail.get_stream_reason[0] != '\0') {
- e_debug(_mail->event,
- "Opened mail because: %s",
- mail->mail.get_stream_reason);
- }
_mail->mail_stream_opened = TRUE;
if (!data->initialized_wrapper_stream &&
}
}
-int index_mail_opened(struct mail *mail ATTR_UNUSED,
+int index_mail_opened(struct mail *mail,
struct istream **stream ATTR_UNUSED)
{
+ mail_opened_event(mail);
return 0;
}
and 1 if attachment was found. */
int mail_set_attachment_keywords(struct mail *mail);
+/* Emit mail opened events */
+void mail_opened_event(struct mail *mail);
+
void mailbox_set_deleted(struct mailbox *box);
int mailbox_mark_index_deleted(struct mailbox *box, bool del);
/* Easy wrapper for getting mailbox's MAILBOX_LIST_PATH_TYPE_MAILBOX.
return ret;
}
+
+void mail_opened_event(struct mail *mail)
+{
+ struct mail_private *pmail =
+ container_of(mail, struct mail_private, mail);
+ struct event_passthrough *e = event_create_passthrough(mail->event)->
+ set_name("mail_opened")->
+ add_str("reason", pmail->get_stream_reason);
+ if (pmail->get_stream_reason != NULL)
+ e_debug(e->event(), "Opened mail because: %s",
+ pmail->get_stream_reason);
+ else
+ e_debug(e->event(), "Opened mail");
+}