From d3c0bb047dcf10ea143fda58bda953fe324f196e Mon Sep 17 00:00:00 2001 From: iequidoo Date: Sat, 21 Mar 2026 09:27:47 -0300 Subject: [PATCH] fix: Make pre-messages w/o text want MDNs (#8004) This fixes failing `test_pre_msg_mdn_before_sending_full`. Maybe it's even good that MDNs will be sent for pre-messages only having placeholder text with the viewtype and size, at least this way we notify the contact that we've noticed the message. Anyway, with adding message previews the problem will be solved for the corresponding viewtypes. --- src/mimeparser.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/mimeparser.rs b/src/mimeparser.rs index 64a354f68..d09fde7ec 100644 --- a/src/mimeparser.rs +++ b/src/mimeparser.rs @@ -957,14 +957,16 @@ impl MimeMessage { self.parse_attachments(); // See if an MDN is requested from the other side + let mut wants_mdn = false; if self.decryption_error.is_none() - && !self.parts.is_empty() + && (!self.parts.is_empty() || matches!(&self.pre_message, PreMessageMode::Pre { .. })) && let Some(ref dn_to) = self.chat_disposition_notification_to { // Check that the message is not outgoing. let from = &self.from.addr; if !context.is_self_addr(from).await? { if from.to_lowercase() == dn_to.addr.to_lowercase() { + wants_mdn = true; if let Some(part) = self.parts.last_mut() { part.param.set_int(Param::WantsMdn, 1); } @@ -986,7 +988,9 @@ impl MimeMessage { typ: Viewtype::Text, ..Default::default() }; - + if wants_mdn { + part.param.set_int(Param::WantsMdn, 1); + } if let Some(ref subject) = self.get_subject() && !self.has_chat_version() && self.webxdc_status_update.is_none()