Mercurial > dovecot > original-hg > dovecot-1.2
changeset 6104:a019240a9df1 HEAD
Cache everything interesting while saving a message.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Thu, 19 Jul 2007 05:52:22 +0300 |
parents | 15f845e16a91 |
children | 8f79b333fc47 |
files | src/lib-storage/index/mbox/mbox-save.c |
diffstat | 1 files changed, 14 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-storage/index/mbox/mbox-save.c Thu Jul 19 05:37:19 2007 +0300 +++ b/src/lib-storage/index/mbox/mbox-save.c Thu Jul 19 05:52:22 2007 +0300 @@ -346,11 +346,6 @@ if ((hdr == NULL && ctx->eoh_input_offset == (uoff_t)-1) || (hdr != NULL && hdr->eoh)) ctx->eoh_input_offset = ctx->input->v_offset; - - if (ctx->mail != NULL) { - index_mail_parse_header(NULL, hdr, - (struct index_mail *)ctx->mail); - } } static void mbox_save_x_delivery_id(struct mbox_save_context *ctx) @@ -458,8 +453,6 @@ } if (mail_set_seq(dest_mail, ctx->seq) < 0) i_unreached(); - index_mail_parse_header_init((struct index_mail *)dest_mail, - NULL); } mbox_save_append_flag_headers(ctx->headers, save_flags); mbox_save_append_keyword_headers(ctx, keywords); @@ -486,6 +479,12 @@ MAIL_STORAGE_FLAG_SAVE_CRLF) != 0 ? o_stream_create_crlf(default_pool, ctx->output) : o_stream_create_lf(default_pool, ctx->output); + if (ctx->mail != NULL) { + input = index_mail_cache_parse_init(ctx->mail, + ctx->input); + i_stream_unref(&ctx->input); + ctx->input = input; + } } *ctx_r = &ctx->ctx; @@ -513,6 +512,9 @@ return write_error(ctx); ctx->last_char = data[size-1]; i_stream_skip(ctx->input, size); + + if (ctx->mail != NULL) + index_mail_cache_parse_continue(ctx->mail); } if (ctx->last_char != '\n') { @@ -547,6 +549,9 @@ return write_error(ctx); ctx->last_char = data[size-1]; i_stream_skip(ctx->input, size); + + if (ctx->mail != NULL) + index_mail_cache_parse_continue(ctx->mail); } if (ctx->last_char != '\n') { @@ -604,6 +609,8 @@ t_pop(); } + if (ctx->mail != NULL) + index_mail_cache_parse_deinit(ctx->mail); if (ctx->input != NULL) i_stream_destroy(&ctx->input); if (ctx->body_output != NULL)