[dovecot-cvs] dovecot/src/lib-storage/index index-mail-headers.c, 1.70, 1.71 index-mail.c, 1.115, 1.116
tss at dovecot.org
tss at dovecot.org
Tue Apr 3 19:22:43 EEST 2007
Update of /var/lib/cvs/dovecot/src/lib-storage/index
In directory talvi:/tmp/cvs-serv2553/lib-storage/index
Modified Files:
index-mail-headers.c index-mail.c
Log Message:
Removed message_parse_from_parts(). Added message_parser_init_from_parts()
instead. Searching code now uses it whenever possible.
Index: index-mail-headers.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/index-mail-headers.c,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -d -r1.70 -r1.71
--- index-mail-headers.c 15 Dec 2006 18:38:19 -0000 1.70
+++ index-mail-headers.c 3 Apr 2007 16:22:41 -0000 1.71
@@ -340,6 +340,23 @@
index_mail_parse_header(mail->data.parts, hdr, mail);
}
+static void index_mail_init_parser(struct index_mail *mail)
+{
+ struct index_mail_data *data = &mail->data;
+
+ if (data->parser_ctx != NULL)
+ (void)message_parser_deinit(&data->parser_ctx);
+
+ if (data->parts == NULL) {
+ data->parser_ctx =
+ message_parser_init(mail->data_pool, data->stream);
+ } else {
+ data->parser_ctx =
+ message_parser_init_from_parts(data->parts,
+ data->stream, FALSE);
+ }
+}
+
int index_mail_parse_headers(struct index_mail *mail,
struct mailbox_header_lookup_ctx *headers)
{
@@ -357,10 +374,7 @@
data->save_bodystructure_header)) {
/* initialize bodystructure parsing in case we read the whole
message. */
- if (data->parser_ctx != NULL)
- (void)message_parser_deinit(&mail->data.parser_ctx);
- data->parser_ctx =
- message_parser_init(mail->data_pool, data->stream);
+ index_mail_init_parser(mail);
message_parser_parse_header(data->parser_ctx, &data->hdr_size,
index_mail_parse_part_header_cb,
mail);
Index: index-mail.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/index-mail.c,v
retrieving revision 1.115
retrieving revision 1.116
diff -u -d -r1.115 -r1.116
--- index-mail.c 1 Feb 2007 22:35:01 -0000 1.115
+++ index-mail.c 3 Apr 2007 16:22:41 -0000 1.116
@@ -581,7 +581,6 @@
struct index_mail_data *data = &mail->data;
uoff_t old_offset;
- i_assert(data->parts == NULL);
i_assert(data->parser_ctx != NULL);
old_offset = data->stream->v_offset;
@@ -619,6 +618,7 @@
i_stream_seek(data->stream, 0);
if (!data->hdr_size_set) {
if ((data->access_part & PARSE_HDR) != 0) {
+ (void)get_cached_parts(mail);
if (index_mail_parse_headers(mail, NULL) < 0)
return NULL;
} else {
@@ -675,30 +675,12 @@
/* we haven't parsed the header yet */
data->save_bodystructure_header = TRUE;
data->save_bodystructure_body = TRUE;
+ (void)get_cached_parts(mail);
if (index_mail_parse_headers(mail, NULL) < 0)
return;
}
- if (data->parts == NULL)
- index_mail_parse_body(mail, field);
- else {
- /* body structure is known already, so use it to parse only
- the MIME headers */
- uoff_t old_offset;
-
- i_assert(data->parts->next == NULL);
-
- old_offset = data->stream->v_offset;
- i_stream_seek(data->stream,
- data->hdr_size.physical_size);
-
- message_parse_from_parts(data->parts->children,
- data->stream,
- parse_bodystructure_part_header,
- mail->data_pool);
- data->parsed_bodystructure = TRUE;
- i_stream_seek(data->stream, old_offset);
- }
+ index_mail_parse_body(mail, field);
}
static void
More information about the dovecot-cvs
mailing list