Mercurial > dovecot > original-hg > dovecot-1.2
changeset 4263:56f4b7ee6c2f HEAD
Some more cleanups
author | Timo Sirainen <timo.sirainen@movial.fi> |
---|---|
date | Mon, 08 May 2006 16:04:10 +0300 |
parents | d7dd2f20c15c |
children | b3fa08c14747 |
files | src/lib-storage/index/index-mail.c |
diffstat | 1 files changed, 19 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-storage/index/index-mail.c Mon May 08 15:50:22 2006 +0300 +++ b/src/lib-storage/index/index-mail.c Mon May 08 16:04:10 2006 +0300 @@ -459,10 +459,13 @@ } } - /* now convert the parsed bodystructure to string and save to cache */ + /* If BODY is fetched first but BODYSTRUCTURE is also wanted, we don't + normally want to first cache BODY and then BODYSTRUCTURE. So check + the wanted_fields also in here. */ if (plain_bodystructure) cache_bodystructure = FALSE; - else if (field == MAIL_CACHE_IMAP_BODYSTRUCTURE) { + else if (field == MAIL_CACHE_IMAP_BODYSTRUCTURE || + (mail->wanted_fields & MAIL_FETCH_IMAP_BODYSTRUCTURE) != 0) { cache_bodystructure = mail_cache_field_can_add(mail->trans->cache_trans, data->seq, cache_field_bodystructure); @@ -517,6 +520,19 @@ } } +static void index_mail_parse_body_finish(struct index_mail *mail, + enum index_cache_field field) +{ + mail->data.parts = message_parser_deinit(&mail->data.parser_ctx); + + mail->data.body_size = mail->data.parts->body_size; + mail->data.body_size_set = TRUE; + + index_mail_body_parsed_cache_flags(mail); + index_mail_body_parsed_cache_message_parts(mail); + index_mail_body_parsed_cache_bodystructure(mail, field); +} + static void index_mail_parse_body(struct index_mail *mail, enum index_cache_field field) { @@ -539,14 +555,7 @@ } else { message_parser_parse_body(data->parser_ctx, NULL, NULL); } - data->parts = message_parser_deinit(&data->parser_ctx); - - data->body_size = data->parts->body_size; - data->body_size_set = TRUE; - - index_mail_body_parsed_cache_flags(mail); - index_mail_body_parsed_cache_message_parts(mail); - index_mail_body_parsed_cache_bodystructure(mail, field); + index_mail_parse_body_finish(mail, field); } struct istream *index_mail_init_stream(struct index_mail *_mail,