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:
bjoern
2021-01-23 23:21:18 +01:00
committed by GitHub
parent 2a8c418d54
commit e9c582c4e4
8 changed files with 183 additions and 19 deletions

View File

@@ -822,16 +822,16 @@ async fn add_parts(
// if indicated by the parser,
// we save the full mime-message and add a flag
// that the ui should show button to display the full message.
//
// (currently, we skip saving mime-messages for encrypted messages
// as there is probably no huge intersection between html-messages and encrypted messages,
// however, that should be doable, we need the decrypted mime-structure in this case)
// a flag used to avoid adding "show full message" button to multiple parts of the message.
let mut save_mime_modified = mime_parser.is_mime_modified && !mime_parser.was_encrypted();
let mut save_mime_modified = mime_parser.is_mime_modified;
let mime_headers = if save_mime_headers || save_mime_modified {
Some(String::from_utf8_lossy(imf_raw).to_string())
if mime_parser.was_encrypted() {
Some(String::from_utf8_lossy(&mime_parser.decoded_data).to_string())
} else {
Some(String::from_utf8_lossy(imf_raw).to_string())
}
} else {
None
};