From 6ded0d3bc1c08a7d05032a890bb3b1ef60baa55a Mon Sep 17 00:00:00 2001 From: Hocuri Date: Sat, 6 Jun 2020 17:53:57 +0200 Subject: [PATCH] Do not show error messages in chat --- src/dc_receive_imf.rs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/dc_receive_imf.rs b/src/dc_receive_imf.rs index db096480a..b644165b3 100644 --- a/src/dc_receive_imf.rs +++ b/src/dc_receive_imf.rs @@ -405,6 +405,17 @@ async fn add_parts( .await .unwrap_or_default(); + if chat_id.is_unset() { + // check if the message belongs to a mailing list + if mime_parser.failed_msg.is_some() { + *chat_id = ChatId::new(DC_CHAT_ID_TRASH); + info!( + context, + "Message belongs to an NDN list and is not shown in a chat.", + ); + } + } + // get the chat_id - a chat_id here is no indicator that the chat is displayed in the normal list, // it might also be blocked and displayed in the deaddrop as a result if chat_id.is_unset() { @@ -2327,7 +2338,6 @@ mod tests { #[async_std::test] async fn test_parse_ndn() { - use std::io::Write; use std::{thread, time}; let t = dummy_context().await; @@ -2374,8 +2384,6 @@ mod tests { println!("Loading msg {}…", msg_id); let msg = Message::load_from_db(&t.ctx, msg_id).await.unwrap(); - std::io::stdout().flush().unwrap(); - thread::sleep(time::Duration::from_millis(1000)); assert_eq!(msg.state, MessageState::OutFailed); assert_eq!(