mirror of
https://github.com/chatmail/core.git
synced 2026-04-19 22:46:29 +03:00
forward html-messages properly (#2151)
* add failing tests for forwarding html-mails * let MsgId.get_html() return an option * write html-part to local database on forwarding * add html-part to forwarded non-dc messages * read HTML-parts from encrypted messages * avoid clone() * Received:-header is no longer needed since #2152 * Update src/html.rs Co-authored-by: Floris Bruynooghe <flub@devork.be> * Update src/html.rs Co-authored-by: Floris Bruynooghe <flub@devork.be> * Update src/mimeparser.rs Co-authored-by: Floris Bruynooghe <flub@devork.be> * prefer 'orig' over 'org' as abbreviation for 'original' * improve comment on tests * prefer 'try_into()' over 'as u32' to avoid panics on bad data * simplify ffi Co-authored-by: Floris Bruynooghe <flub@devork.be>
This commit is contained in:
@@ -69,6 +69,12 @@ pub struct MimeMessage {
|
||||
// if this flag is set, the parts/text/etc. are just close to the original mime-message;
|
||||
// clients should offer a way to view the original message in this case
|
||||
pub is_mime_modified: bool,
|
||||
|
||||
/// The decrypted, raw mime structure.
|
||||
///
|
||||
/// This is non-empty only if the message was actually encrypted. It is used
|
||||
/// for e.g. late-parsing HTML.
|
||||
pub decoded_data: Vec<u8>,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
@@ -136,7 +142,7 @@ impl MimeMessage {
|
||||
headers.remove("chat-verified");
|
||||
|
||||
// Memory location for a possible decrypted message.
|
||||
let mail_raw;
|
||||
let mut mail_raw = Vec::new();
|
||||
let mut gossipped_addr = Default::default();
|
||||
|
||||
let (mail, signatures, warn_empty_signature) =
|
||||
@@ -228,6 +234,7 @@ impl MimeMessage {
|
||||
group_avatar: None,
|
||||
failure_report: None,
|
||||
is_mime_modified: false,
|
||||
decoded_data: Vec::new(),
|
||||
};
|
||||
parser.parse_mime_recursive(context, &mail).await?;
|
||||
parser.maybe_remove_bad_parts();
|
||||
@@ -240,6 +247,10 @@ impl MimeMessage {
|
||||
}
|
||||
}
|
||||
|
||||
if parser.is_mime_modified {
|
||||
parser.decoded_data = mail_raw;
|
||||
}
|
||||
|
||||
Ok(parser)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user