Lines Matching refs:_ctx
149 maildir_save_add(struct mail_save_context *_ctx, const char *tmp_fname,
152 struct maildir_save_context *ctx = MAILDIR_SAVECTX(_ctx);
153 struct mail_save_data *mdata = &_ctx->data;
215 mail_set_seq_saving(_ctx->dest_mail, ctx->seq);
220 index_copy_cache_fields(_ctx, src_mail, ctx->seq);
223 input = index_mail_cache_parse_init(_ctx->dest_mail,
227 ctx->cur_dest_mail = _ctx->dest_mail;
232 void maildir_save_set_dest_basename(struct mail_save_context *_ctx,
236 struct maildir_save_context *ctx = MAILDIR_SAVECTX(_ctx);
410 int maildir_save_begin(struct mail_save_context *_ctx, struct istream *input)
412 struct maildir_save_context *ctx = MAILDIR_SAVECTX(_ctx);
430 mf = maildir_save_add(_ctx, fname, NULL);
431 if (_ctx->data.guid != NULL) {
432 maildir_save_set_dest_basename(_ctx, mf,
433 _ctx->data.guid);
439 _ctx->data.output = o_stream_create_fd_file(ctx->fd, 0, FALSE);
440 o_stream_set_name(_ctx->data.output, t_strdup_printf(
442 o_stream_cork(_ctx->data.output);
448 int maildir_save_continue(struct mail_save_context *_ctx)
450 struct maildir_save_context *ctx = MAILDIR_SAVECTX(_ctx);
455 if (index_storage_save_continue(_ctx, ctx->input,
516 static int maildir_save_finish_real(struct mail_save_context *_ctx)
518 struct maildir_save_context *ctx = MAILDIR_SAVECTX(_ctx);
532 if (!ctx->failed && o_stream_finish(_ctx->data.output) < 0) {
534 mail_set_critical(_ctx->dest_mail,
536 o_stream_get_error(_ctx->data.output));
541 if (_ctx->data.save_date != (time_t)-1) {
543 struct index_mail *mail = INDEX_MAIL(_ctx->dest_mail);
544 uint32_t t = _ctx->data.save_date;
560 ctx->file_last->size = _ctx->data.output->offset;
566 output_errno = _ctx->data.output->stream_errno;
567 output_errstr = t_strdup(o_stream_get_error(_ctx->data.output));
568 o_stream_destroy(&_ctx->data.output);
574 mail_set_critical(_ctx->dest_mail,
582 mail_set_critical(_ctx->dest_mail, "lseek(%s) failed: %m", path);
599 mail_set_critical(_ctx->dest_mail,
614 mail_set_critical(_ctx->dest_mail,
637 void maildir_save_cancel(struct mail_save_context *_ctx)
639 struct maildir_save_context *ctx = MAILDIR_SAVECTX(_ctx);
642 (void)maildir_save_finish(_ctx);
954 int maildir_transaction_save_commit_pre(struct mail_save_context *_ctx)
956 struct maildir_save_context *ctx = MAILDIR_SAVECTX(_ctx);
957 struct mailbox_transaction_context *_t = _ctx->transaction;
961 i_assert(_ctx->data.output == NULL);
988 maildir_transaction_save_rollback(_ctx);
999 maildir_transaction_save_rollback(_ctx);
1044 maildir_transaction_save_rollback(_ctx);
1050 void maildir_transaction_save_commit_post(struct mail_save_context *_ctx,
1053 struct maildir_save_context *ctx = MAILDIR_SAVECTX(_ctx);
1055 _ctx->transaction = NULL; /* transaction is already freed */
1062 void maildir_transaction_save_rollback(struct mail_save_context *_ctx)
1064 struct maildir_save_context *ctx = MAILDIR_SAVECTX(_ctx);
1066 i_assert(_ctx->data.output == NULL);