Skip to content

Commit

Permalink
lib-storage: Add struct mail_save_context.copy_src_mail
Browse files Browse the repository at this point in the history
  • Loading branch information
sirainen authored and GitLab committed Nov 30, 2016
1 parent 0ad3dea commit d0d37a7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/lib-storage/mail-storage-private.h
Expand Up @@ -635,6 +635,10 @@ struct mail_save_data {
struct mail_save_context {
struct mailbox_transaction_context *transaction;
struct mail *dest_mail;
/* Set during mailbox_copy(). This is useful when copying is
implemented via save, and the save_*() methods want to access the
source mail. */
struct mail *copy_src_mail;

/* data that changes for each saved mail */
struct mail_save_data data;
Expand Down
3 changes: 3 additions & 0 deletions src/lib-storage/mail-storage.c
Expand Up @@ -2265,7 +2265,9 @@ static int mailbox_copy_int(struct mail_save_context **_ctx, struct mail *mail)
}

i_assert(!ctx->copying_or_moving);
i_assert(ctx->copy_src_mail == NULL);
ctx->copying_or_moving = TRUE;
ctx->copy_src_mail = mail;
ctx->finishing = TRUE;
T_BEGIN {
ret = t->box->v.copy(ctx, backend_mail);
Expand All @@ -2280,6 +2282,7 @@ static int mailbox_copy_int(struct mail_save_context **_ctx, struct mail *mail)
mailbox_keywords_unref(&keywords);
i_assert(!ctx->unfinished);

ctx->copy_src_mail = NULL;
ctx->copying_via_save = FALSE;
ctx->copying_or_moving = FALSE;
ctx->saving = FALSE; /* if we came from mailbox_save_using_mail() */
Expand Down

0 comments on commit d0d37a7

Please sign in to comment.