[dovecot-cvs] dovecot/src/lib-storage/index index-mail.c,1.96,1.97
tss-movial at dovecot.org
tss-movial at dovecot.org
Mon May 8 16:04:13 EEST 2006
Update of /var/lib/cvs/dovecot/src/lib-storage/index
In directory talvi:/tmp/cvs-serv12015
Modified Files:
index-mail.c
Log Message:
Some more cleanups
Index: index-mail.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/index-mail.c,v
retrieving revision 1.96
retrieving revision 1.97
diff -u -d -r1.96 -r1.97
--- index-mail.c 8 May 2006 12:50:22 -0000 1.96
+++ index-mail.c 8 May 2006 13:04:10 -0000 1.97
@@ -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,
More information about the dovecot-cvs
mailing list