Mercurial > dovecot > core-2.2
diff src/lib-storage/index/index-search.c @ 569:cafe57140f5c HEAD
SEARCH TEXT now checks only field values (not names) from headers. RFC
doesn't really specify how this should be handled and I think it's better
this way. Also it's easier to handle correctly :)
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sun, 03 Nov 2002 12:11:47 +0200 |
parents | f2aa58c2afd0 |
children | debb8468514e |
line wrap: on
line diff
--- a/src/lib-storage/index/index-search.c Sun Nov 03 10:39:43 2002 +0200 +++ b/src/lib-storage/index/index-search.c Sun Nov 03 12:11:47 2002 +0200 @@ -474,6 +474,10 @@ if (ctx->name_len != len || strncasecmp(ctx->name, arg->hdr_field_name, len) != 0) return; + case SEARCH_TEXT: + /* TEXT goes through all headers */ + ctx->custom_header = TRUE; + break; default: return; } @@ -540,14 +544,6 @@ } } -static void search_text_header(MailSearchArg *arg, void *context) -{ - SearchTextContext *ctx = context; - - if (arg->type == SEARCH_TEXT) - search_text(arg, ctx); -} - static void search_text_body(MailSearchArg *arg, void *context) { SearchTextContext *ctx = context; @@ -595,7 +591,6 @@ { IBuffer *inbuf; MessageSize hdr_size; - uoff_t old_limit; int have_headers, have_body, have_text; /* first check what we need to use */ @@ -607,7 +602,7 @@ have_headers ? NULL : &hdr_size, NULL)) return FALSE; - if (have_headers) { + if (have_headers || have_text) { SearchHeaderContext hdr_ctx; memset(&hdr_ctx, 0, sizeof(hdr_ctx)); @@ -620,18 +615,6 @@ search_header, &hdr_ctx); } - if (have_text) { - if (inbuf->v_offset != 0) { - /* need to rewind back to beginning of headers */ - i_buffer_seek(inbuf, 0); - } - - old_limit = inbuf->v_limit; - i_buffer_set_read_limit(inbuf, hdr_size.physical_size); - search_arg_match_data(inbuf, args, search_text_header); - i_buffer_set_read_limit(inbuf, old_limit); - } - if (have_text || have_body) { if (inbuf->v_offset == 0) { /* skip over headers */