Skip to content

Commit d3c0bb0

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 29ae891 commit d3c0bb0

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
@@ -957,14 +957,16 @@ impl MimeMessage {
957957
self.parse_attachments();
958958

959959
// See if an MDN is requested from the other side
960+
let mut wants_mdn = false;
960961
if self.decryption_error.is_none()
961-
&& !self.parts.is_empty()
962+
&& (!self.parts.is_empty() || matches!(&self.pre_message, PreMessageMode::Pre { .. }))
962963
&& let Some(ref dn_to) = self.chat_disposition_notification_to
963964
{
964965
// Check that the message is not outgoing.
965966
let from = &self.from.addr;
966967
if !context.is_self_addr(from).await? {
967968
if from.to_lowercase() == dn_to.addr.to_lowercase() {
969+
wants_mdn = true;
968970
if let Some(part) = self.parts.last_mut() {
969971
part.param.set_int(Param::WantsMdn, 1);
970972
}
@@ -986,7 +988,9 @@ impl MimeMessage {
986988
typ: Viewtype::Text,
987989
..Default::default()
988990
};
989-
991+
if wants_mdn {
992+
part.param.set_int(Param::WantsMdn, 1);
993+
}
990994
if let Some(ref subject) = self.get_subject()
991995
&& !self.has_chat_version()
992996
&& self.webxdc_status_update.is_none()

0 commit comments

Comments
 (0)