dovecot-2.2: message parser: Added MESSAGE_PARSER_FLAG_INCLUDE_B...
dovecot at dovecot.org
dovecot at dovecot.org
Wed Jun 20 02:23:54 EEST 2012
details: http://hg.dovecot.org/dovecot-2.2/rev/6846c2e50eba
changeset: 14605:6846c2e50eba
user: Timo Sirainen <tss at iki.fi>
date: Wed Jun 20 02:22:27 2012 +0300
description:
message parser: Added MESSAGE_PARSER_FLAG_INCLUDE_BOUNDARIES flag.
diffstat:
src/lib-mail/message-parser.c | 10 +++++++++-
src/lib-mail/message-parser.h | 8 +++++---
2 files changed, 14 insertions(+), 4 deletions(-)
diffs (56 lines):
diff -r 217fe26a3176 -r 6846c2e50eba src/lib-mail/message-parser.c
--- a/src/lib-mail/message-parser.c Wed Jun 20 02:21:54 2012 +0300
+++ b/src/lib-mail/message-parser.c Wed Jun 20 02:22:27 2012 +0300
@@ -269,7 +269,10 @@
ptr = memchr(block_r->data, '\n', block_r->size);
if (ptr == NULL) {
parse_body_add_block(ctx, block_r);
- return 1;
+ if (block_r->size > 0 &&
+ (ctx->flags & MESSAGE_PARSER_FLAG_INCLUDE_BOUNDARIES) != 0)
+ return 1;
+ return 0;
}
/* found the LF */
@@ -286,6 +289,9 @@
/* a new MIME part begins */
ctx->parse_next_block = parse_next_mime_header_init;
}
+ if (block_r->size > 0 &&
+ (ctx->flags & MESSAGE_PARSER_FLAG_INCLUDE_BOUNDARIES) != 0)
+ return 1;
return ctx->parse_next_block(ctx, block_r);
}
@@ -333,6 +339,8 @@
ctx->parse_next_block = parse_next_body_skip_boundary_line;
+ if ((ctx->flags & MESSAGE_PARSER_FLAG_INCLUDE_BOUNDARIES) != 0)
+ return 1;
return ctx->parse_next_block(ctx, block_r);
}
diff -r 217fe26a3176 -r 6846c2e50eba src/lib-mail/message-parser.h
--- a/src/lib-mail/message-parser.h Wed Jun 20 02:21:54 2012 +0300
+++ b/src/lib-mail/message-parser.h Wed Jun 20 02:22:27 2012 +0300
@@ -6,13 +6,15 @@
enum message_parser_flags {
/* Don't return message bodies in message_blocks. */
- MESSAGE_PARSER_FLAG_SKIP_BODY_BLOCK = 0x01,
+ MESSAGE_PARSER_FLAG_SKIP_BODY_BLOCK = 0x01,
/* Buggy software creates Content-Type: headers without Mime-Version:
header. By default we allow this and assume message is MIME if
Content-Type: is found. This flag disables this. */
- MESSAGE_PARSER_FLAG_MIME_VERSION_STRICT = 0x02,
+ MESSAGE_PARSER_FLAG_MIME_VERSION_STRICT = 0x02,
/* Return multipart (preamble and epilogue) blocks */
- MESSAGE_PARSER_FLAG_INCLUDE_MULTIPART_BLOCKS = 0x04
+ MESSAGE_PARSER_FLAG_INCLUDE_MULTIPART_BLOCKS = 0x04,
+ /* Return --boundary lines */
+ MESSAGE_PARSER_FLAG_INCLUDE_BOUNDARIES = 0x08
};
/* Note that these flags are used directly by message-parser-serialize, so
More information about the dovecot-cvs
mailing list