dovecot-2.0: fts: Give binary MIME part data only to FTS backend...

dovecot at dovecot.org dovecot at dovecot.org
Tue Jun 22 23:38:25 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/6fca3a8622f8
changeset: 11614:6fca3a8622f8
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Jun 22 21:38:18 2010 +0100
description:
fts: Give binary MIME part data only to FTS backends that support it.

diffstat:

 src/plugins/fts/fts-api-private.h |  4 +++-
 src/plugins/fts/fts-storage.c     |  8 ++++++--
 2 files changed, 9 insertions(+), 3 deletions(-)

diffs (39 lines):

diff -r 86665b63c70b -r 6fca3a8622f8 src/plugins/fts/fts-api-private.h
--- a/src/plugins/fts/fts-api-private.h	Tue Jun 22 21:14:22 2010 +0100
+++ b/src/plugins/fts/fts-api-private.h	Tue Jun 22 21:38:18 2010 +0100
@@ -50,7 +50,9 @@
 	   optimized. */
 	FTS_BACKEND_FLAG_SUBSTRING_LOOKUPS	= 0x01,
 	/* Backend supports virtual mailbox lookups. */
-	FTS_BACKEND_FLAG_VIRTUAL_LOOKUPS	= 0x02
+	FTS_BACKEND_FLAG_VIRTUAL_LOOKUPS	= 0x02,
+	/* Backend supports indexing binary MIME parts */
+	FTS_BACKEND_FLAG_BINARY_MIME_PARTS	= 0x04
 };
 
 struct fts_backend {
diff -r 86665b63c70b -r 6fca3a8622f8 src/plugins/fts/fts-storage.c
--- a/src/plugins/fts/fts-storage.c	Tue Jun 22 21:14:22 2010 +0100
+++ b/src/plugins/fts/fts-storage.c	Tue Jun 22 21:38:18 2010 +0100
@@ -143,6 +143,7 @@
 
 static int fts_build_mail(struct fts_storage_build_context *ctx, uint32_t uid)
 {
+	enum message_decoder_flags decoder_flags = MESSAGE_DECODER_FLAG_DTCASE;
 	struct istream *input;
 	struct message_parser_ctx *parser;
 	struct message_decoder_context *decoder;
@@ -160,8 +161,11 @@
 	parser = message_parser_init(pool_datastack_create(), input,
 				     MESSAGE_HEADER_PARSER_FLAG_CLEAN_ONELINE,
 				     0);
-	decoder = message_decoder_init(MESSAGE_DECODER_FLAG_DTCASE |
-				       MESSAGE_DECODER_FLAG_RETURN_BINARY);
+
+
+	if ((ctx->build->backend->flags & FTS_BACKEND_FLAG_BINARY_MIME_PARTS) != 0)
+		decoder_flags |= MESSAGE_DECODER_FLAG_RETURN_BINARY;
+	decoder = message_decoder_init(decoder_flags);
 	for (;;) {
 		ret = message_parser_parse_next_block(parser, &raw_block);
 		i_assert(ret != 0);


More information about the dovecot-cvs mailing list