]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-lda: mail-deliver - Add support for event API.
authorStephan Bosch <stephan.bosch@dovecot.fi>
Sun, 3 Mar 2019 23:28:42 +0000 (00:28 +0100)
committerTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 8 Apr 2019 07:17:43 +0000 (07:17 +0000)
src/lib-lda/mail-deliver.c
src/lib-lda/mail-deliver.h

index 91132409e3ff9ff63322d37aa3fdef828592ba7c..0aa702c55cc80eba85de48386136216f5a23d9bd 100644 (file)
 #define MAIL_DELIVER_STORAGE_CONTEXT(obj) \
        MODULE_CONTEXT_REQUIRE(obj, mail_deliver_storage_module)
 
+struct event_category event_category_mail_delivery = {
+       .name = "local-delivery",
+};
+
 struct mail_deliver_user {
        union mail_user_module_context module_ctx;
        struct mail_deliver_context *deliver_ctx;
@@ -317,10 +321,21 @@ void mail_deliver_init(struct mail_deliver_context *ctx,
        ctx->rcpt_user = input->rcpt_user;
        ctx->rcpt_default_mailbox = p_strdup(ctx->pool,
                                             input->rcpt_default_mailbox);
+
+       ctx->event = event_create(input->event_parent);
+       event_add_category(ctx->event, &event_category_mail_delivery);
+
+       if (ctx->rcpt_to != NULL) {
+               event_add_str(ctx->event, "rcpt_to",
+                             smtp_address_encode(ctx->rcpt_to));
+       }
+       smtp_params_rcpt_add_to_event(&ctx->rcpt_params,
+                                     SMTP_CAPABILITY__ORCPT, ctx->event);
 }
 
 void mail_deliver_deinit(struct mail_deliver_context *ctx)
 {
+       event_unref(&ctx->event);
        pool_unref(&ctx->pool);
 }
 
index 8ff9c7a5a1dfc6c7d862775b6358f3bb6329198b..9c4902db6381bcb08f4a33014f03d49b5cc5f3e4 100644 (file)
@@ -24,6 +24,7 @@ struct mail_deliver_input {
        const struct lda_settings *set;
        const struct smtp_submit_settings *smtp_set;
        struct mail_deliver_session *session;
+       struct event *event_parent;
 
        unsigned int session_time_msecs;
        struct timeval delivery_time_started;
@@ -56,6 +57,7 @@ struct mail_deliver_context {
        const struct lda_settings *set;
        const struct smtp_submit_settings *smtp_set;
        struct mail_deliver_session *session;
+       struct event *event;
 
        unsigned int session_time_msecs;
        struct timeval delivery_time_started;