[dovecot-cvs] dovecot/src/lib-storage/index index-mail-headers.c, 1.59, 1.60 index-mail.c, 1.93, 1.94 index-search.c, 1.112, 1.113

tss-movial at dovecot.org tss-movial at dovecot.org
Mon May 8 11:46:25 EEST 2006


Update of /var/lib/cvs/dovecot/src/lib-storage/index
In directory talvi:/tmp/cvs-serv713/lib-storage/index

Modified Files:
	index-mail-headers.c index-mail.c index-search.c 
Log Message:
Rewrote the message bodystructure parser to allow parsing from non-blocking streams. Also did a couple of API changes and cleanups.



Index: index-mail-headers.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/index-mail-headers.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- index-mail-headers.c	26 Feb 2006 10:05:15 -0000	1.59
+++ index-mail-headers.c	8 May 2006 08:46:22 -0000	1.60
@@ -335,14 +335,22 @@
 }
 
 static void
-index_mail_parse_header_cb(struct message_part *part,
-			   struct message_header_line *hdr, void *context)
+index_mail_parse_part_header_cb(struct message_part *part,
+				struct message_header_line *hdr, void *context)
 {
 	struct index_mail *mail = context;
 
 	index_mail_parse_header(part, hdr, mail);
 }
 
+static void
+index_mail_parse_header_cb(struct message_header_line *hdr, void *context)
+{
+	struct index_mail *mail = context;
+
+	index_mail_parse_header(mail->data.parts, hdr, mail);
+}
+
 int index_mail_parse_headers(struct index_mail *mail,
 			     struct mailbox_header_lookup_ctx *headers)
 {
@@ -359,10 +367,11 @@
 		data->parser_ctx =
 			message_parser_init(mail->data_pool, data->stream);
 		message_parser_parse_header(data->parser_ctx, &data->hdr_size,
-					    index_mail_parse_header_cb, mail);
+					    index_mail_parse_part_header_cb,
+					    mail);
 	} else {
 		/* just read the header */
-		message_parse_header(data->parts, data->stream, &data->hdr_size,
+		message_parse_header(data->stream, &data->hdr_size,
 				     index_mail_parse_header_cb, mail);
 	}
 	data->hdr_size_set = TRUE;
@@ -372,8 +381,7 @@
 }
 
 static void
-imap_envelope_parse_callback(struct message_part *part __attr_unused__,
-			     struct message_header_line *hdr, void *context)
+imap_envelope_parse_callback(struct message_header_line *hdr, void *context)
 {
 	struct index_mail *mail = context;
 
@@ -396,7 +404,7 @@
 	if (mail->data.envelope == NULL && stream != NULL) {
 		/* we got the headers from cache - parse them to get the
 		   envelope */
-		message_parse_header(NULL, stream, NULL,
+		message_parse_header(stream, NULL,
 				     imap_envelope_parse_callback, mail);
 		mail->data.save_envelope = FALSE;
 	}

Index: index-mail.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/index-mail.c,v
retrieving revision 1.93
retrieving revision 1.94
diff -u -d -r1.93 -r1.94
--- index-mail.c	26 Feb 2006 11:24:38 -0000	1.93
+++ index-mail.c	8 May 2006 08:46:22 -0000	1.94
@@ -380,11 +380,11 @@
 		i_assert(!data->save_bodystructure_header);
 		message_parser_parse_body(data->parser_ctx,
 					  parse_bodystructure_part_header,
-					  NULL, mail->data_pool);
+					  mail->data_pool);
 		data->save_bodystructure_body = FALSE;
 		data->parsed_bodystructure = TRUE;
 	} else {
-		message_parser_parse_body(data->parser_ctx, NULL, NULL, NULL);
+		message_parser_parse_body(data->parser_ctx, NULL, NULL);
 	}
 	data->parts = message_parser_deinit(&data->parser_ctx);
 

Index: index-search.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/index-search.c,v
retrieving revision 1.112
retrieving revision 1.113
diff -u -d -r1.112 -r1.113
--- index-search.c	24 Apr 2006 09:34:28 -0000	1.112
+++ index-search.c	8 May 2006 08:46:22 -0000	1.113
@@ -430,8 +430,7 @@
 	}
 }
 
-static void search_header(struct message_part *part __attr_unused__,
-                          struct message_header_line *hdr, void *context)
+static void search_header(struct message_header_line *hdr, void *context)
 {
 	struct search_header_context *ctx = context;
 
@@ -546,8 +545,7 @@
 		hdr_ctx.parse_headers = headers == NULL;
 
 		index_mail_parse_header_init(ctx->imail, headers_ctx);
-		message_parse_header(NULL, input, NULL,
-				     search_header, &hdr_ctx);
+		message_parse_header(input, NULL, search_header, &hdr_ctx);
 		if (headers_ctx != NULL)
 			mailbox_header_lookup_deinit(&headers_ctx);
 	} else {



More information about the dovecot-cvs mailing list