[dovecot-cvs] dovecot/src/lib-storage/index index-search.c,1.40,1.41

cras at procontrol.fi cras at procontrol.fi
Sun Nov 3 12:11:50 EET 2002


Update of /home/cvs/dovecot/src/lib-storage/index
In directory danu:/tmp/cvs-serv24173

Modified Files:
	index-search.c 
Log Message:
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 :)



Index: index-search.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/index-search.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- index-search.c	3 Nov 2002 08:39:44 -0000	1.40
+++ index-search.c	3 Nov 2002 10:11:47 -0000	1.41
@@ -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));
@@ -618,18 +613,6 @@
 		hdr_ctx.args = args;
 		message_parse_header(NULL, inbuf, &hdr_size,
 				     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) {




More information about the dovecot-cvs mailing list