Only reset status to "" if a text/plain part without signature is received

Otherwise sending a message without plaintext part
resets the signature. It is particularly dangerous
in multidevice case, because it's easy to accidentally
reset the signature on your other device with a non-text message.
This commit is contained in:
link2xt
2022-10-24 23:04:03 +00:00
parent 4aae48b0a1
commit 3c774b02e5
3 changed files with 25 additions and 21 deletions

View File

@@ -90,6 +90,9 @@ pub(crate) struct MimeMessage {
pub(crate) delivery_report: Option<DeliveryReport>,
/// 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<String>,
// 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());
}
}
_ => {}
}