mail-deliver.h revision 44f3f472a49078312432b785fddcfe7b95928391
c7480644202e5451fbed448508ea29a25cffc99cTimo Sirainen /* List of users who have already saved this mail to their INBOX */
c7480644202e5451fbed448508ea29a25cffc99cTimo Sirainen /* Session ID, used as log line prefix if non-NULL. */
6ef7e31619edfaa17ed044b45861d106a86191efTimo Sirainen /* Mail to save */
c7480644202e5451fbed448508ea29a25cffc99cTimo Sirainen /* Envelope sender, if known. */
c7480644202e5451fbed448508ea29a25cffc99cTimo Sirainen /* Destination user */
b44650b0f48a4b5f0dc240ed836833a00b643b9fTimo Sirainen /* Original recipient address */
d43c646d4b84635aa795946555be04a553d5413aTimo Sirainen /* Final recipient address (typically same as dest_addr) */
d43c646d4b84635aa795946555be04a553d5413aTimo Sirainen /* Mailbox where mail should be saved, unless e.g. Sieve does
09ea3aa6bc03544a9e712d263f07976255aaaaf0Timo Sirainen something to it. */
b44650b0f48a4b5f0dc240ed836833a00b643b9fTimo Sirainen /* Filled with destination mail, if save_dest_mail=TRUE.
b44650b0f48a4b5f0dc240ed836833a00b643b9fTimo Sirainen The caller must free the mail, its transaction and close
b44650b0f48a4b5f0dc240ed836833a00b643b9fTimo Sirainen the mailbox. */
09ea3aa6bc03544a9e712d263f07976255aaaaf0Timo Sirainen /* mail_deliver_log() caches the var expand table here */
f968e62caa52a8924bd05ebf76ff515b5c18e17bTimo Sirainentypedef int deliver_mail_func_t(struct mail_deliver_context *ctx,
c7480644202e5451fbed448508ea29a25cffc99cTimo Sirainenmail_deliver_get_log_var_expand_table(struct mail *mail, const char *message);
517d1e7142d57299c733b30423e35e7e1f8d01d6Timo Sirainenvoid mail_deliver_log(struct mail_deliver_context *ctx, const char *fmt, ...)
b44650b0f48a4b5f0dc240ed836833a00b643b9fTimo Sirainenconst char *mail_deliver_get_address(struct mail *mail, const char *header);
f968e62caa52a8924bd05ebf76ff515b5c18e17bTimo Sirainenconst char *mail_deliver_get_return_address(struct mail_deliver_context *ctx);
f968e62caa52a8924bd05ebf76ff515b5c18e17bTimo Sirainenconst char *mail_deliver_get_new_message_id(struct mail_deliver_context *ctx);
517d1e7142d57299c733b30423e35e7e1f8d01d6Timo Sirainenstruct mail_deliver_session *mail_deliver_session_init(void);
517d1e7142d57299c733b30423e35e7e1f8d01d6Timo Sirainenvoid mail_deliver_session_deinit(struct mail_deliver_session **session);
517d1e7142d57299c733b30423e35e7e1f8d01d6Timo Sirainen/* Try to open mailbox for saving. Returns 0 if ok, -1 if error. The box may
517d1e7142d57299c733b30423e35e7e1f8d01d6Timo Sirainen be returned even with -1, and the caller must free it then. */
e80203675151ef9d4f3f850cf02041042eb13096Timo Sirainenint mail_deliver_save_open(struct mail_deliver_save_open_context *ctx,
517d1e7142d57299c733b30423e35e7e1f8d01d6Timo Sirainen enum mail_error *error_r, const char **error_str_r);
517d1e7142d57299c733b30423e35e7e1f8d01d6Timo Sirainenint mail_deliver_save(struct mail_deliver_context *ctx, const char *mailbox,
517d1e7142d57299c733b30423e35e7e1f8d01d6Timo Sirainen enum mail_flags flags, const char *const *keywords,
b44650b0f48a4b5f0dc240ed836833a00b643b9fTimo Sirainenvoid mail_deliver_deduplicate_guid_if_needed(struct mail_deliver_context *ctx,
517d1e7142d57299c733b30423e35e7e1f8d01d6Timo Sirainen const char *mailbox);
c7480644202e5451fbed448508ea29a25cffc99cTimo Sirainenint mail_deliver(struct mail_deliver_context *ctx,
09ea3aa6bc03544a9e712d263f07976255aaaaf0Timo Sirainen/* Sets the deliver_mail hook and returns the previous hook,
09ea3aa6bc03544a9e712d263f07976255aaaaf0Timo Sirainen which the new_hook should call if it's non-NULL. */