mirror of
https://github.com/chatmail/core.git
synced 2026-04-21 15:36:30 +03:00
add dc_msg_set_html() api (#2153)
* draft dc_msg_set_html() api * implement setting 'html to be send' * test sending html-parts * more flexible html-partbuilder * write html-parts to database and also send them * add 'sendhtml' command to repl tool
This commit is contained in:
14
src/chat.rs
14
src/chat.rs
@@ -30,6 +30,7 @@ use crate::dc_tools::{
|
||||
};
|
||||
use crate::ephemeral::{delete_expired_messages, schedule_ephemeral_task, Timer as EphemeralTimer};
|
||||
use crate::events::EventType;
|
||||
use crate::html::new_html_mimepart;
|
||||
use crate::job::{self, Action};
|
||||
use crate::message::{self, InvalidMsgId, Message, MessageState, MsgId};
|
||||
use crate::mimeparser::SystemMessage;
|
||||
@@ -1060,8 +1061,17 @@ 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
|
||||
let new_mime_headers = if msg.has_html() {
|
||||
let html = if msg.param.exists(Param::Forwarded) {
|
||||
msg.get_id().get_html(context).await
|
||||
} else {
|
||||
msg.param.get(Param::SendHtml).map(|s| s.to_string())
|
||||
};
|
||||
if let Some(html) = html {
|
||||
Some(new_html_mimepart(html).await.build().as_string())
|
||||
} else {
|
||||
None
|
||||
}
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user