]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lmtp: Moved client_open_raw_mail() from commands.c to lmtp-local.c.
authorStephan Bosch <stephan.bosch@dovecot.fi>
Sun, 17 Sep 2017 09:13:17 +0000 (11:13 +0200)
committerStephan Bosch <stephan.bosch@dovecot.fi>
Thu, 7 Dec 2017 23:08:14 +0000 (00:08 +0100)
src/lmtp/commands.c
src/lmtp/lmtp-local.c
src/lmtp/lmtp-local.h

index adc0d3875f5e4e45abb44ff30b8a73e0955d7e81..040299c029b8159fb84b71edeb7efb8304c29eea 100644 (file)
@@ -572,36 +572,6 @@ static struct istream *client_get_input(struct client *client)
        return cinput;
 }
 
-static int client_open_raw_mail(struct client *client, struct istream *input)
-{
-       static const char *wanted_headers[] = {
-               "From", "To", "Message-ID", "Subject", "Return-Path",
-               NULL
-       };
-       struct mailbox *box;
-       struct mailbox_transaction_context *trans;
-       struct mailbox_header_lookup_ctx *headers_ctx;
-       enum mail_error error;
-
-       if (raw_mailbox_alloc_stream(client->raw_mail_user, input,
-                                    (time_t)-1, smtp_address_encode(client->state.mail_from),
-                                    &box) < 0) {
-               i_error("Can't open delivery mail as raw: %s",
-                       mailbox_get_last_internal_error(box, &error));
-               mailbox_free(&box);
-               client_rcpt_fail_all(client);
-               return -1;
-       }
-
-       trans = mailbox_transaction_begin(box, 0, __func__);
-
-       headers_ctx = mailbox_header_lookup_init(box, wanted_headers);
-       client->state.raw_mail = mail_alloc(trans, 0, headers_ctx);
-       mailbox_header_lookup_unref(&headers_ctx);
-       mail_set_seq(client->state.raw_mail, 1);
-       return 0;
-}
-
 static void
 client_input_data_write_local(struct client *client, struct istream *input)
 {
index 2d5156989f34b3df5b4553c74ff1fda870b1dc0f..a8d49be38bdbe4f64981fba141abc7035e83f467 100644 (file)
@@ -13,6 +13,7 @@
 #include "mail-namespace.h"
 #include "mail-deliver.h"
 #include "mail-autoexpunge.h"
+#include "index/raw/raw-storage.h"
 #include "master-service.h"
 #include "smtp-address.h"
 #include "smtp-submit-settings.h"
@@ -50,7 +51,8 @@ client_send_line_overquota(struct client *client,
                smtp_address_encode(rcpt->address), error);
 }
 
-void client_rcpt_fail_all(struct client *client)
+static void
+client_rcpt_fail_all(struct client *client)
 {
        struct mail_recipient *const *rcptp;
 
@@ -371,3 +373,33 @@ uid_t client_deliver_to_rcpts(struct client *client,
        }
        return first_uid;
 }
+
+int client_open_raw_mail(struct client *client, struct istream *input)
+{
+       static const char *wanted_headers[] = {
+               "From", "To", "Message-ID", "Subject", "Return-Path",
+               NULL
+       };
+       struct mailbox *box;
+       struct mailbox_transaction_context *trans;
+       struct mailbox_header_lookup_ctx *headers_ctx;
+       enum mail_error error;
+
+       if (raw_mailbox_alloc_stream(client->raw_mail_user, input,
+                                    (time_t)-1, smtp_address_encode(client->state.mail_from),
+                                    &box) < 0) {
+               i_error("Can't open delivery mail as raw: %s",
+                       mailbox_get_last_internal_error(box, &error));
+               mailbox_free(&box);
+               client_rcpt_fail_all(client);
+               return -1;
+       }
+
+       trans = mailbox_transaction_begin(box, 0, __func__);
+
+       headers_ctx = mailbox_header_lookup_init(box, wanted_headers);
+       client->state.raw_mail = mail_alloc(trans, 0, headers_ctx);
+       mailbox_header_lookup_unref(&headers_ctx);
+       mail_set_seq(client->state.raw_mail, 1);
+       return 0;
+}
index 245d55f19f3c569071376cb4720a816470cd7b8a..c23b913c71b72b4bb62bf74ef2687b77cbed8759 100644 (file)
@@ -7,8 +7,6 @@ struct mail_deliver_session;
 
 void client_rcpt_anvil_disconnect(const struct mail_recipient *rcpt);
 
-void client_rcpt_fail_all(struct client *client);
-
 bool cmd_rcpt_finish(struct client *client, struct mail_recipient *rcpt);
 
 void rcpt_anvil_lookup_callback(const char *reply, void *context);
@@ -16,4 +14,6 @@ void rcpt_anvil_lookup_callback(const char *reply, void *context);
 uid_t client_deliver_to_rcpts(struct client *client,
                                    struct mail_deliver_session *session);
 
+int client_open_raw_mail(struct client *client, struct istream *input);
+
 #endif