From e858a32aa189e1ed869296ff62ef7e7df739425c Mon Sep 17 00:00:00 2001 From: link2xt Date: Sun, 30 Jan 2022 10:52:03 +0000 Subject: [PATCH] smtp: cancel message sending by removing the message This restores the logic removed in afd8c0d879fa0fdd625a3317fa334f975e3f9754 --- CHANGELOG.md | 2 ++ src/smtp.rs | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c6170c32c..9ad5e3b42 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ - use webxdc app name in chatlist/quotes/replies etc. #3027 - refactorings #3023 - remove direct dependency on `byteorder` crate #3031 +- make it possible to cancel message sending by removing the message #3034, + this was previosuly removed in 1.71.0 #2939 ### Fixes - fix splitting off text from webxdc messages #3032 diff --git a/src/smtp.rs b/src/smtp.rs index 6a6734764..e8f19cc38 100644 --- a/src/smtp.rs +++ b/src/smtp.rs @@ -369,6 +369,19 @@ pub(crate) async fn send_msg_to_smtp( ) .collect::>(); + // If there is a msg-id and it does not exist in the db, cancel sending. this happens if + // dc_delete_msgs() was called before the generated mime was sent out. + if !message::exists(context, msg_id) + .await + .with_context(|| format!("failed to check message {} existence", msg_id))? + { + info!( + context, + "Sending of message {} was cancelled by the user.", msg_id + ); + return Ok(()); + } + let status = match smtp_send( context, &recipients_list,