dovecot: When searching only message bodies, we skipped headers ...
dovecot at dovecot.org
dovecot at dovecot.org
Mon Dec 3 14:47:59 EET 2007
details: http://hg.dovecot.org/dovecot/rev/f28a14a07a98
changeset: 6913:f28a14a07a98
user: Timo Sirainen <tss at iki.fi>
date: Mon Dec 03 14:47:45 2007 +0200
description:
When searching only message bodies, we skipped headers completely so body
decoding didn't work for non-ASCII.
diffstat:
1 file changed, 20 insertions(+), 4 deletions(-)
src/lib-mail/message-search.c | 24 ++++++++++++++++++++----
diffs (48 lines):
diff -r b326327b1f10 -r f28a14a07a98 src/lib-mail/message-search.c
--- a/src/lib-mail/message-search.c Mon Dec 03 14:37:30 2007 +0200
+++ b/src/lib-mail/message-search.c Mon Dec 03 14:47:45 2007 +0200
@@ -132,6 +132,7 @@ int message_search_more(struct message_s
int message_search_more(struct message_search_context *ctx,
struct message_block *raw_block)
{
+ struct message_header_line *hdr = raw_block->hdr;
struct message_block block;
if (raw_block->part != ctx->prev_part) {
@@ -141,10 +142,19 @@ int message_search_more(struct message_s
ctx->prev_part = raw_block->part;
}
- if (raw_block->hdr != NULL) {
- handle_header(ctx, raw_block->hdr);
- if ((ctx->flags & MESSAGE_SEARCH_FLAG_SKIP_HEADERS) != 0)
- return 0;
+ if (hdr != NULL) {
+ handle_header(ctx, hdr);
+ if ((ctx->flags & MESSAGE_SEARCH_FLAG_SKIP_HEADERS) != 0) {
+ /* we want to search only message bodies, but
+ but decoder needs some headers so that it can
+ decode the body properly. */
+ if (hdr->name_len != 12 && hdr->name_len != 25)
+ return 0;
+ if (strcasecmp(hdr->name, "Content-Type") != 0 &&
+ strcasecmp(hdr->name,
+ "Content-Transfer-Encoding") != 0)
+ return 0;
+ }
} else {
/* body */
if (!ctx->content_type_text)
@@ -152,6 +162,12 @@ int message_search_more(struct message_s
}
if (!message_decoder_decode_next_block(ctx->decoder, raw_block, &block))
return 0;
+
+ if (block.hdr != NULL &&
+ (ctx->flags & MESSAGE_SEARCH_FLAG_SKIP_HEADERS) != 0) {
+ /* Content-* header */
+ return 0;
+ }
return message_search_more_decoded2(ctx, &block);
}
More information about the dovecot-cvs
mailing list