dovecot-2.2: fts: Added message_part to fts_backend_build_key.

dovecot at dovecot.org dovecot at dovecot.org
Thu Apr 17 14:13:34 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/1b02ece5298c
changeset: 17239:1b02ece5298c
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Apr 17 16:12:00 2014 +0200
description:
fts: Added message_part to fts_backend_build_key.
This allows FTS backends to index MIME parts separately from each others.

diffstat:

 src/plugins/fts/fts-api.h        |  1 +
 src/plugins/fts/fts-build-mail.c |  8 ++++++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diffs (50 lines):

diff -r e5635fc0710f -r 1b02ece5298c src/plugins/fts/fts-api.h
--- a/src/plugins/fts/fts-api.h	Thu Apr 17 16:09:52 2014 +0200
+++ b/src/plugins/fts/fts-api.h	Thu Apr 17 16:12:00 2014 +0200
@@ -24,6 +24,7 @@
 struct fts_backend_build_key {
 	uint32_t uid;
 	enum fts_backend_build_key_type type;
+	struct message_part *part;
 
 	/* for _KEY_HDR: */
 	const char *hdr_name;
diff -r e5635fc0710f -r 1b02ece5298c src/plugins/fts/fts-build-mail.c
--- a/src/plugins/fts/fts-build-mail.c	Thu Apr 17 16:09:52 2014 +0200
+++ b/src/plugins/fts/fts-build-mail.c	Thu Apr 17 16:12:00 2014 +0200
@@ -111,6 +111,7 @@
 	key.uid = ctx->mail->uid;
 	key.type = block->part->physical_pos == 0 ?
 		FTS_BACKEND_BUILD_KEY_HDR : FTS_BACKEND_BUILD_KEY_MIME_HDR;
+	key.part = block->part;
 	key.hdr_name = hdr->name;
 
 	if (!fts_backend_update_set_build_key(ctx->update_ctx, &key))
@@ -139,7 +140,8 @@
 }
 
 static bool
-fts_build_body_begin(struct fts_mail_build_context *ctx, bool *binary_body_r)
+fts_build_body_begin(struct fts_mail_build_context *ctx,
+		     struct message_part *part, bool *binary_body_r)
 {
 	struct mail_storage *storage;
 	const char *content_type;
@@ -150,6 +152,7 @@
 	*binary_body_r = FALSE;
 	memset(&key, 0, sizeof(key));
 	key.uid = ctx->mail->uid;
+	key.part = part;
 
 	content_type = ctx->content_type != NULL ?
 		ctx->content_type : "text/plain";
@@ -323,7 +326,8 @@
 			/* always handle headers */
 		} else if (raw_block.size == 0) {
 			/* end of headers */
-			skip_body = !fts_build_body_begin(&ctx, &binary_body);
+			skip_body = !fts_build_body_begin(&ctx, raw_block.part,
+							  &binary_body);
 			if (binary_body)
 				message_decoder_set_return_binary(decoder, TRUE);
 			body_part = TRUE;


More information about the dovecot-cvs mailing list