uint32_t uid_validity;
ARRAY_TYPE(seq_range) saved_uids;
bool hide_saved_uids;
+
+ const char *error_string;
+ enum mail_error mail_error;
};
static void client_send_sendalive_if_needed(struct client *client)
msgset_generator_next(©_ctx->srcset_ctx, mail->uid);
}
- if (mailbox_search_deinit(&search_ctx) < 0)
+ if (ret < 0) {
+ copy_ctx->error_string =
+ mailbox_get_last_error(copy_ctx->destbox, ©_ctx->mail_error);
+ }
+ if (mailbox_search_deinit(&search_ctx) < 0 && ret >= 0) {
+ copy_ctx->error_string =
+ mailbox_get_last_error(client->mailbox, ©_ctx->mail_error);
ret = -1;
+ }
if (ret <= 0)
mailbox_transaction_rollback(&t);
ret = 0;
} else {
ret = -1;
+ copy_ctx->error_string =
+ mailbox_get_last_error(copy_ctx->destbox, ©_ctx->mail_error);
}
} else {
if (changes.no_read_perm)
/* move failed, don't expunge anything */
mailbox_transaction_rollback(&src_trans);
} else {
- if (mailbox_transaction_commit(&src_trans) < 0)
+ if (mailbox_transaction_commit(&src_trans) < 0 && ret >= 0) {
+ copy_ctx->error_string =
+ mailbox_get_last_error(client->mailbox, ©_ctx->mail_error);
ret = -1;
+ }
}
return ret;
}
static bool cmd_copy_full(struct client_command_context *cmd, bool move)
{
struct client *client = cmd->client;
- struct mail_storage *dest_storage;
struct mailbox *destbox;
struct mail_search_args *search_args;
struct imap_search_seqset_iter *seqset_iter = NULL;
array_free(©_ctx.saved_uids);
- dest_storage = mailbox_get_storage(destbox);
if (destbox != client->mailbox) {
if (move)
sync_flags |= MAILBOX_SYNC_FLAG_EXPUNGE;
"NO ["IMAP_RESP_CODE_EXPUNGEISSUED"] "
"Some of the requested messages no longer exist.");
} else {
- client_send_storage_error(cmd, dest_storage);
+ client_send_error(cmd, copy_ctx.error_string,
+ copy_ctx.mail_error);
return TRUE;
}
}