mirror of
https://github.com/chatmail/core.git
synced 2026-04-21 07:26: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:
15
src/chat.rs
15
src/chat.rs
@@ -1060,6 +1060,12 @@ impl Chat {
|
||||
EphemeralTimer::Enabled { duration } => time() + i64::from(duration),
|
||||
};
|
||||
|
||||
let new_mime_headers = if msg.param.exists(Param::Forwarded) && msg.mime_modified {
|
||||
msg.get_id().get_html_as_rawmime(context).await
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
// add message to the database
|
||||
|
||||
if context
|
||||
@@ -1078,10 +1084,12 @@ impl Chat {
|
||||
hidden,
|
||||
mime_in_reply_to,
|
||||
mime_references,
|
||||
mime_modified,
|
||||
mime_headers,
|
||||
location_id,
|
||||
ephemeral_timer,
|
||||
ephemeral_timestamp)
|
||||
VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);",
|
||||
VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);",
|
||||
paramsv![
|
||||
new_rfc724_mid,
|
||||
self.id,
|
||||
@@ -1095,6 +1103,8 @@ impl Chat {
|
||||
msg.hidden,
|
||||
msg.in_reply_to.as_deref().unwrap_or_default(),
|
||||
new_references,
|
||||
new_mime_headers.is_some(),
|
||||
new_mime_headers,
|
||||
location_id as i32,
|
||||
ephemeral_timer,
|
||||
ephemeral_timestamp
|
||||
@@ -2738,7 +2748,8 @@ pub async fn forward_msgs(
|
||||
// we tested a sort of broadcast
|
||||
// by not marking own forwarded messages as such,
|
||||
// however, this turned out to be to confusing and unclear.
|
||||
msg.param.set_int(Param::Forwarded, 1);
|
||||
msg.param
|
||||
.set_int(Param::Forwarded, src_msg_id.to_u32() as i32);
|
||||
|
||||
msg.param.remove(Param::GuaranteeE2ee);
|
||||
msg.param.remove(Param::ForcePlaintext);
|
||||
|
||||
Reference in New Issue
Block a user