diff --git a/CHANGELOG.md b/CHANGELOG.md index d0074a528..b0ef8b5fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ - Show a warning if quota list is empty #4261 - Update "accounts.toml" atomically - Don't let blocking be bypassed using groups #4316 +- Do not reset status on other devices when sending signed reaction messages #3692 ## [1.112.7] - 2023-04-17 diff --git a/src/mimeparser.rs b/src/mimeparser.rs index 455c5733f..d67324455 100644 --- a/src/mimeparser.rs +++ b/src/mimeparser.rs @@ -90,6 +90,9 @@ pub(crate) struct MimeMessage { pub(crate) delivery_report: Option, /// Standard USENET signature, if any. + /// + /// `None` means no text part was received, empty string means a text part without a footer is + /// received. pub(crate) footer: Option, // if this flag is set, the parts/text/etc. are just close to the original mime-message; @@ -1059,6 +1062,7 @@ impl MimeMessage { } }; + let is_plaintext = mime_type == mime::TEXT_PLAIN; let mut dehtml_failed = false; let SimplifiedText { @@ -1139,7 +1143,9 @@ impl MimeMessage { self.is_forwarded = true; } - self.footer = footer; + if self.footer.is_none() && is_plaintext { + self.footer = Some(footer.unwrap_or_default()); + } } _ => {} } diff --git a/src/receive_imf.rs b/src/receive_imf.rs index c3b2712bf..b321c2f67 100644 --- a/src/receive_imf.rs +++ b/src/receive_imf.rs @@ -309,28 +309,25 @@ pub(crate) async fn receive_imf_inner( } } - // Always update the status, even if there is no footer, to allow removing the status. - // - // Ignore MDNs though, as they never contain the signature even if user has set it. // Ignore footers from mailinglists as they are often created or modified by the mailinglist software. - if mime_parser.mdn_reports.is_empty() - && !mime_parser.is_mailinglist_message() - && is_partial_download.is_none() - && from_id != ContactId::UNDEFINED - && context - .update_contacts_timestamp(from_id, Param::StatusTimestamp, sent_timestamp) - .await? - { - if let Err(err) = contact::set_status( - context, - from_id, - mime_parser.footer.clone().unwrap_or_default(), - mime_parser.was_encrypted(), - mime_parser.has_chat_version(), - ) - .await + if let Some(footer) = &mime_parser.footer { + if !mime_parser.is_mailinglist_message() + && from_id != ContactId::UNDEFINED + && context + .update_contacts_timestamp(from_id, Param::StatusTimestamp, sent_timestamp) + .await? { - warn!(context, "Cannot update contact status: {err:#}."); + if let Err(err) = contact::set_status( + context, + from_id, + footer.to_string(), + mime_parser.was_encrypted(), + mime_parser.has_chat_version(), + ) + .await + { + warn!(context, "Cannot update contact status: {err:#}."); + } } }