struct index_mail *imail;
struct mail_search_arg *args;
+ struct message_block decoded_block;
+ bool decoded_block_set;
+
struct message_header_line *hdr;
unsigned int parse_headers:1;
if (msg_search_ctx == NULL)
return;
- T_BEGIN {
+ if (!ctx->decoded_block_set) { T_BEGIN {
struct message_address *addr;
string_t *str;
default:
i_unreached();
}
- ret = message_search_more(msg_search_ctx, &block) ? 1 : 0;
- } T_END;
+ ret = message_search_more_get_decoded(msg_search_ctx, &block,
+ &ctx->decoded_block) ? 1 : 0;
+ ctx->decoded_block_set = TRUE;
+ } T_END; } else {
+ /* this block was already decoded and saved by an earlier
+ search arg. use the already-decoded block to avoid
+ duplicating work. */
+ ret = message_search_more_decoded(msg_search_ctx,
+ &ctx->decoded_block) ? 1 : 0;
+ }
/* there may be multiple headers. don't mark this failed yet. */
if (ret > 0)
if (ctx->custom_header || strcasecmp(hdr->name, "Date") == 0) {
ctx->hdr = hdr;
+ ctx->decoded_block_set = FALSE;
ctx->custom_header = FALSE;
(void)mail_search_args_foreach(ctx->args, search_header_arg, ctx);
}