]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lmtp: local: Create a client vfunc for local delivery.
authorStephan Bosch <stephan.bosch@dovecot.fi>
Sat, 3 Nov 2018 12:34:20 +0000 (13:34 +0100)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Tue, 25 Jun 2019 11:19:16 +0000 (11:19 +0000)
This way,for example, the struct mail_deliver_context passed to mail_deliver()
can be adjusted by plugins.

src/lmtp/client.c
src/lmtp/client.h
src/lmtp/lmtp-local.c
src/lmtp/lmtp-local.h

index 01a5d311d492f320ed195c173b5c4710610e586d..72ddf6a973ead88cc36fc9ecbf6ac525863c5672 100644 (file)
@@ -383,4 +383,6 @@ static const struct lmtp_client_vfuncs lmtp_client_vfuncs = {
        .cmd_mail = client_default_cmd_mail,
        .cmd_rcpt = client_default_cmd_rcpt,
        .cmd_data = client_default_cmd_data,
+
+       .local_deliver = lmtp_local_default_deliver,
 };
index 8b29c0b3386eb1d15d60029b2d256f0b64c297ce..06111042e220bc4958ea0ff6a69f5c726fbd12dc 100644 (file)
@@ -6,6 +6,8 @@
 
 #define CLIENT_MAIL_DATA_MAX_INMEMORY_SIZE (1024*128)
 
+struct mail_storage;
+struct mail_deliver_context;
 union lmtp_module_context;
 struct lmtp_recipient;
 struct client;
@@ -42,6 +44,11 @@ struct lmtp_client_vfuncs {
                        struct smtp_server_cmd_ctx *cmd,
                        struct smtp_server_transaction *trans,
                        struct istream *data_input, uoff_t data_size);
+
+       int (*local_deliver)(struct client *client,
+                            struct lmtp_recipient *lrcpt,
+                            struct mail_deliver_context *dctx,
+                            struct mail_storage **storage_r);
 };
 
 struct client {
index 47be193e6e7fd3daabd0246ddc451291e58ab1ce..aaba846d20da9d0bdce327a5fc420265c134315d 100644 (file)
@@ -436,7 +436,8 @@ lmtp_local_deliver(struct lmtp_local *local,
                   struct mail_deliver_session *session)
 {
        struct client *client = local->client;
-       struct smtp_server_recipient *rcpt = llrcpt->rcpt->rcpt;
+       struct lmtp_recipient *lrcpt = llrcpt->rcpt;
+       struct smtp_server_recipient *rcpt = lrcpt->rcpt;
        struct smtp_address *rcpt_to = rcpt->path;
        unsigned int rcpt_idx = rcpt->index;
        struct mail_storage_service_user *service_user = llrcpt->service_user;
@@ -572,7 +573,7 @@ lmtp_local_deliver(struct lmtp_local *local,
                                   &trans->timestamp);
        dctx.delivery_time_started = delivery_time_started;
 
-       if (mail_deliver(&dctx, &storage) == 0) {
+       if (client->v.local_deliver(client, lrcpt, &dctx, &storage) == 0) {
                if (dctx.dest_mail != NULL) {
                        i_assert(local->first_saved_mail == NULL);
                        local->first_saved_mail = dctx.dest_mail;
@@ -609,6 +610,14 @@ lmtp_local_deliver(struct lmtp_local *local,
        return ret;
 }
 
+int lmtp_local_default_deliver(struct client *client ATTR_UNUSED,
+                              struct lmtp_recipient *lrcpt ATTR_UNUSED,
+                              struct mail_deliver_context *dctx,
+                              struct mail_storage **storage_r)
+{
+       return mail_deliver(dctx, storage_r);
+}
+
 static uid_t
 lmtp_local_deliver_to_rcpts(struct lmtp_local *local,
                            struct smtp_server_cmd_ctx *cmd,
index e75c09378cfad1caf9e3ae30cd7599f0137b80a6..e577806b3e7455afaf1563aa61ea57577c8af1fe 100644 (file)
@@ -20,6 +20,11 @@ void lmtp_local_add_headers(struct lmtp_local *local,
                            struct smtp_server_transaction *trans,
                            string_t *headers);
 
+int lmtp_local_default_deliver(struct client *client,
+                              struct lmtp_recipient *lrcpt,
+                              struct mail_deliver_context *dctx,
+                              struct mail_storage **storage_r);
+
 void lmtp_local_data(struct client *client,
                     struct smtp_server_cmd_ctx *cmd,
                     struct smtp_server_transaction *trans,