]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lmtp client: Added support for writing given string as headers.
authorTimo Sirainen <tss@iki.fi>
Tue, 10 Nov 2009 01:04:28 +0000 (20:04 -0500)
committerTimo Sirainen <tss@iki.fi>
Tue, 10 Nov 2009 01:04:28 +0000 (20:04 -0500)
--HG--
branch : HEAD

src/lib-lda/lmtp-client.c
src/lib-lda/lmtp-client.h

index fa8bb0c1222304fef1e29896806e9d19616ecae8..88f8f0b144e5c7a0ae4d848cfe7c3e32865a09b3 100644 (file)
@@ -49,6 +49,7 @@ struct lmtp_client {
        struct io *io;
        int fd;
 
+       const char *data_header;
        ARRAY_DEFINE(recipients, struct lmtp_rcpt);
        unsigned int rcpt_next_receive_idx;
        unsigned int rcpt_next_data_idx;
@@ -348,6 +349,8 @@ static int lmtp_client_input_line(struct lmtp_client *client, const char *line)
                }
                client->input_state++;
                o_stream_cork(client->output);
+               if (client->data_header != NULL)
+                       o_stream_send_str(client->output, client->data_header);
                lmtp_client_send_data(client);
                o_stream_uncork(client->output);
                break;
@@ -441,6 +444,11 @@ int lmtp_client_connect_tcp(struct lmtp_client *client,
        return 0;
 }
 
+void lmtp_client_set_data_header(struct lmtp_client *client, const char *str)
+{
+       client->data_header = p_strdup(client->pool, str);
+}
+
 static void lmtp_client_send_rcpts(struct lmtp_client *client)
 {
        const struct lmtp_rcpt *rcpt;
index ac9ce78927d94710bfa40757c0411133c299244c..f16668859828d97a81cb8130f2400f447a3f155e 100644 (file)
@@ -22,6 +22,9 @@ int lmtp_client_connect_tcp(struct lmtp_client *client,
                            enum lmtp_client_protocol protocol,
                            const char *host, unsigned int port);
 
+/* Add headers from given string before the rest of the data. The string must
+   use CRLF line feeds and end with CRLF. */
+void lmtp_client_set_data_header(struct lmtp_client *client, const char *str);
 /* Add recipient to the session. rcpt_to_callback is called once LMTP server
    replies with RCPT TO. If RCPT TO was a succees, data_callback is called
    when DATA replies. */