Skip to content

Commit 77edcea

Browse files
committed
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.
1 parent 1c17ade commit 77edcea

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/mimeparser.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -951,14 +951,16 @@ impl MimeMessage {
951951
self.parse_attachments();
952952

953953
// See if an MDN is requested from the other side
954+
let mut wants_mdn = false;
954955
if self.decryption_error.is_none()
955-
&& !self.parts.is_empty()
956+
&& (!self.parts.is_empty() || matches!(&self.pre_message, PreMessageMode::Pre { .. }))
956957
&& let Some(ref dn_to) = self.chat_disposition_notification_to
957958
{
958959
// Check that the message is not outgoing.
959960
let from = &self.from.addr;
960961
if !context.is_self_addr(from).await? {
961962
if from.to_lowercase() == dn_to.addr.to_lowercase() {
963+
wants_mdn = true;
962964
if let Some(part) = self.parts.last_mut() {
963965
part.param.set_int(Param::WantsMdn, 1);
964966
}
@@ -980,7 +982,9 @@ impl MimeMessage {
980982
typ: Viewtype::Text,
981983
..Default::default()
982984
};
983-
985+
if wants_mdn {
986+
part.param.set_int(Param::WantsMdn, 1);
987+
}
984988
if let Some(ref subject) = self.get_subject()
985989
&& !self.has_chat_version()
986990
&& self.webxdc_status_update.is_none()

0 commit comments

Comments
 (0)