# HG changeset patch # User Timo Sirainen # Date 1030946690 -10800 # Node ID eb0659c9841e9c8ffd1b25b4cb8d1c586a468cae # Parent e2fe8921e8adc7c5c1cbe167224c520c0acfa07f when we figure out we should cache old body/bodystructure, use preparsed MessagePart from FIELD_TYPE_MESSAGEPART if it's already there. diff -r e2fe8921e8ad -r eb0659c9841e src/lib-index/mail-index-update.c --- a/src/lib-index/mail-index-update.c Mon Sep 02 05:39:42 2002 +0300 +++ b/src/lib-index/mail-index-update.c Mon Sep 02 09:04:50 2002 +0300 @@ -403,9 +403,26 @@ if (IS_BODYSTRUCTURE_FIELD(cache_fields)) { /* for body / bodystructure, we need need to - fully parse the message */ + fully parse the message. unless it's already parsed + and cached. */ pool = pool_create("index message parser", 2048, FALSE); - part = message_parse(pool, inbuf, update_header_func, &ctx); + + value = update->index->lookup_field_raw(update->index, + update->rec, + FIELD_TYPE_MESSAGEPART, + &size); + if (value == NULL) { + part = message_parse(pool, inbuf, + update_header_func, &ctx); + } else { + /* cached, construct the bodystructure using it. + also we need to parse the header.. */ + part = message_part_deserialize(pool, value, size); + + io_buffer_seek(inbuf, 0); + message_parse_header(NULL, inbuf, NULL, + update_header_func, &ctx); + } /* update our sizes */ update->rec->header_size = part->header_size.physical_size;