changeset 13103:88f1c971f3a9

fts: Make sure build_more() is called at least once, even when message is 0 bytes.
author Timo Sirainen <tss@iki.fi>
date Fri, 22 Jul 2011 13:52:16 +0300
parents ed7f134a9429
children 2224c74b0187
files src/plugins/fts/fts-build.c
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugins/fts/fts-build.c	Fri Jul 22 13:51:57 2011 +0300
+++ b/src/plugins/fts/fts-build.c	Fri Jul 22 13:52:16 2011 +0300
@@ -131,7 +131,7 @@
 	struct message_decoder_context *decoder;
 	struct message_block raw_block, block;
 	struct message_part *prev_part, *parts;
-	bool skip_body = FALSE, body_part = FALSE;
+	bool skip_body = FALSE, body_part = FALSE, body_added = FALSE;
 	int ret;
 
 	ctx->uid = mail->uid;
@@ -200,8 +200,13 @@
 				ret = -1;
 				break;
 			}
+			body_added = TRUE;
 		}
 	}
+	if (ret == 0 && body_part && !skip_body && !body_added) {
+		/* make sure body is added even when it doesn't exist */
+		ret = fts_backend_update_build_more(ctx->update_ctx, NULL, 0);
+	}
 	if (message_parser_deinit(&parser, &parts) < 0)
 		mail_set_cache_corrupted(mail, MAIL_FETCH_MESSAGE_PARTS);
 	message_decoder_deinit(&decoder);