Mercurial > dovecot > original-hg > dovecot-1.2
changeset 6914:9c3f0e180751 HEAD
Index message's all headers (including MIME headers) after the body.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Mon, 03 Dec 2007 15:06:27 +0200 |
parents | f28a14a07a98 |
children | 671c2eb25f3d |
files | src/plugins/fts-squat/squat-trie.c src/plugins/fts/fts-storage.c |
diffstat | 2 files changed, 11 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/src/plugins/fts-squat/squat-trie.c Mon Dec 03 14:47:45 2007 +0200 +++ b/src/plugins/fts-squat/squat-trie.c Mon Dec 03 15:06:27 2007 +0200 @@ -788,7 +788,7 @@ bool multibyte_chars = FALSE; int ret = 0; - uid = uid * 2 + (type == SQUAT_INDEX_TYPE_HEADER ? 0 : 1); + uid = uid * 2 + (type == SQUAT_INDEX_TYPE_HEADER ? 1 : 0); t_push(); char_lengths = t_malloc(size); @@ -1394,7 +1394,7 @@ } /* we'll have to drop either header or body UIDs */ - mask = (type & SQUAT_INDEX_TYPE_HEADER) != 0 ? 0 : 1; + mask = (type & SQUAT_INDEX_TYPE_HEADER) != 0 ? 1 : 0; for (i = 0; i < count; i++) { for (uid = src_range[i].seq1; uid <= src_range[i].seq2; uid++) { if ((uid & 1) == mask)
--- a/src/plugins/fts/fts-storage.c Mon Dec 03 14:47:45 2007 +0200 +++ b/src/plugins/fts/fts-storage.c Mon Dec 03 15:06:27 2007 +0200 @@ -67,14 +67,13 @@ return ret; } -static int fts_build_mail_flush_headers(struct fts_storage_build_context *ctx, - bool root) +static int fts_build_mail_flush_headers(struct fts_storage_build_context *ctx) { if (str_len(ctx->headers) == 0) return 0; if (fts_backend_build_more(ctx->build, ctx->uid, str_data(ctx->headers), - str_len(ctx->headers), root) < 0) + str_len(ctx->headers), TRUE) < 0) return -1; str_truncate(ctx->headers, 0); @@ -144,10 +143,7 @@ fts_build_mail_header(ctx, &block); else if (block.size == 0) { /* end of headers */ - bool root = raw_block.part->parent == NULL; - ret = fts_build_mail_flush_headers(ctx, root); - if (ret < 0) - break; + str_append_c(ctx->headers, '\n'); } else { if (fts_backend_build_more(ctx->build, ctx->uid, block.data, block.size, @@ -159,6 +155,12 @@ } (void)message_parser_deinit(&parser); message_decoder_deinit(&decoder); + + if (ret == 0) { + /* Index all headers at the end. This is required for Squat, + because it can handle only incremental UIDs. */ + ret = fts_build_mail_flush_headers(ctx); + } return ret; }