msg = t_str_new(256);
if (ret <= 0)
mailbox_transaction_rollback(&t);
- else if (mailbox_transaction_commit_get_changes(&t, &changes) < 0)
- ret = -1;
- else if (copy_count == 0) {
+ else if (mailbox_transaction_commit_get_changes(&t, &changes) < 0) {
+ if (mailbox_get_last_mail_error(destbox) == MAIL_ERROR_EXPUNGED) {
+ /* storage backend didn't notice the expunge until
+ at commit time. */
+ ret = 0;
+ } else {
+ ret = -1;
+ }
+ } else if (copy_count == 0) {
str_append(msg, "OK No messages found.");
pool_unref(&changes.pool);
} else if (seq_range_count(&changes.saved_uids) == 0 ||