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.
This commit is contained in:
iequidoo
2026-03-21 09:27:47 -03:00
parent 1c17ade2aa
commit 77edcea3fc

View File

@@ -951,14 +951,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);
}
@@ -980,7 +982,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()