dovecot-1.0: If the first line begins with "From ", ignore it.

dovecot at dovecot.org dovecot at dovecot.org
Sat Sep 22 18:01:41 EEST 2007


details:   http://hg.dovecot.org/dovecot-1.0/rev/4c807839ac0c
changeset: 5413:4c807839ac0c
user:      Timo Sirainen <tss at iki.fi>
date:      Sat Sep 22 18:01:36 2007 +0300
description:
If the first line begins with "From ", ignore it.

diffstat:

1 file changed, 17 insertions(+), 1 deletion(-)
src/deliver/deliver.c |   18 +++++++++++++++++-

diffs (46 lines):

diff -r afb48abd91c0 -r 4c807839ac0c src/deliver/deliver.c
--- a/src/deliver/deliver.c	Sat Sep 22 17:55:14 2007 +0300
+++ b/src/deliver/deliver.c	Sat Sep 22 18:01:36 2007 +0300
@@ -16,6 +16,7 @@
 #include "strescape.h"
 #include "var-expand.h"
 #include "message-address.h"
+#include "message-header-parser.h"
 #include "istream-header-filter.h"
 #include "mbox-storage.h"
 #include "dict-client.h"
@@ -410,10 +411,24 @@ static const char *address_sanitize(cons
 	return ret;
 }
 
+
+static void save_header_callback(struct message_header_line *hdr,
+				 bool *matched, void *context)
+{
+	bool *first = context;
+
+	if (*first) {
+		*first = FALSE;
+		if (hdr != NULL && strncmp(hdr->name, "From ", 5) == 0)
+			*matched = TRUE;
+	}
+}
+
 static struct istream *create_mbox_stream(int fd, const char *envelope_sender)
 {
 	const char *mbox_hdr;
 	struct istream *input_list[4], *input, *input_filter;
+	bool first = TRUE;
 
 	fd_set_nonblock(fd, FALSE);
 
@@ -426,7 +441,8 @@ static struct istream *create_mbox_strea
 						     HEADER_FILTER_NO_CR,
 						     mbox_hide_headers,
 						     mbox_hide_headers_count,
-						     NULL, NULL);
+						     save_header_callback,
+						     &first);
 	i_stream_unref(&input);
 
 	input_list[0] = i_stream_create_from_data(default_pool, mbox_hdr,


More information about the dovecot-cvs mailing list