i_stream_unref(&ctx->ctx.input);
if (ctx->ctx.failed) {
- mail_index_expunge(ctx->ctx.trans, ctx->ctx.seq);
- mail_cache_transaction_reset(ctx->ctx.ctx.transaction->cache_trans);
+ index_storage_save_abort_last(&ctx->ctx.ctx, ctx->ctx.seq);
mdbox_map_append_abort(ctx->append_ctx);
array_delete(&ctx->mails, array_count(&ctx->mails) - 1, 1);
return -1;
} T_END;
if (ctx->ctx.failed) {
- mail_index_expunge(ctx->ctx.trans, ctx->ctx.seq);
- mail_cache_transaction_reset(ctx->ctx.ctx.transaction->cache_trans);
+ index_storage_save_abort_last(&ctx->ctx.ctx, ctx->ctx.seq);
dbox_file_append_rollback(&ctx->append_ctx);
dbox_file_unlink(*files);
dbox_file_unref(files);
}
return 0;
}
+
+void index_storage_save_abort_last(struct mail_save_context *ctx, uint32_t seq)
+{
+ mail_index_expunge(ctx->transaction->itrans, seq);
+ /* currently we can't just drop pending cache updates for this one
+ specific record, so we'll reset the whole cache transaction. */
+ mail_cache_transaction_reset(ctx->transaction->cache_trans);
+}
int index_storage_save_continue(struct mail_save_context *ctx,
struct istream *input,
struct mail *cache_dest_mail);
+void index_storage_save_abort_last(struct mail_save_context *ctx, uint32_t seq);
#endif
{
struct maildir_filename **fm;
- mail_index_expunge(ctx->trans, ctx->seq);
- /* currently we can't just drop pending cache updates for this one
- specific record, so we'll reset the whole cache transaction. */
- mail_cache_transaction_reset(ctx->ctx.transaction->cache_trans);
+ index_storage_save_abort_last(&ctx->ctx, ctx->seq);
ctx->seq--;
for (fm = &ctx->files; (*fm)->next != NULL; fm = &(*fm)->next) ;
}
if (ctx->seq != 0 && ctx->failed) {
- mail_index_expunge(ctx->trans, ctx->seq);
- /* currently we can't just drop pending cache updates for this
- one specific record, so we'll reset the whole cache
- transaction. */
- mail_cache_transaction_reset(ctx->ctx.transaction->cache_trans);
+ index_storage_save_abort_last(&ctx->ctx, ctx->seq);
}
index_save_context_free(_ctx);
return ctx->failed ? -1 : 0;