dovecot-2.0-sslstream: lmtp client: Added support for writing gi...

dovecot at dovecot.org dovecot at dovecot.org
Sat Feb 13 02:56:12 EET 2010


details:   http://hg.dovecot.org/dovecot-2.0-sslstream/rev/147627c8433a
changeset: 10288:147627c8433a
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Nov 09 20:04:28 2009 -0500
description:
lmtp client: Added support for writing given string as headers.

diffstat:

2 files changed, 11 insertions(+)
src/lib-lda/lmtp-client.c |    8 ++++++++
src/lib-lda/lmtp-client.h |    3 +++

diffs (45 lines):

diff -r 353a30947b91 -r 147627c8433a src/lib-lda/lmtp-client.c
--- a/src/lib-lda/lmtp-client.c	Mon Nov 09 20:03:42 2009 -0500
+++ b/src/lib-lda/lmtp-client.c	Mon Nov 09 20:04:28 2009 -0500
@@ -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
 		}
 		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_
 	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;
diff -r 353a30947b91 -r 147627c8433a src/lib-lda/lmtp-client.h
--- a/src/lib-lda/lmtp-client.h	Mon Nov 09 20:03:42 2009 -0500
+++ b/src/lib-lda/lmtp-client.h	Mon Nov 09 20:04:28 2009 -0500
@@ -22,6 +22,9 @@ int lmtp_client_connect_tcp(struct lmtp_
 			    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. */


More information about the dovecot-cvs mailing list