feat: save messages API in JSON RPC (#6554)

relates to https://github.com/deltachat/deltachat-desktop/issues/4596
This commit is contained in:
Nico de Haen
2025-02-18 16:41:04 +01:00
committed by GitHub
parent 0f449cc7eb
commit e0dfba87b6
2 changed files with 20 additions and 0 deletions

View File

@@ -1305,6 +1305,12 @@ impl CommandApi {
Ok(results)
}
async fn save_msgs(&self, account_id: u32, message_ids: Vec<u32>) -> Result<()> {
let ctx = self.get_context(account_id).await?;
let message_ids: Vec<MsgId> = message_ids.into_iter().map(MsgId::new).collect();
chat::save_msgs(&ctx, &message_ids).await
}
// ---------------------------------------------
// contact
// ---------------------------------------------

View File

@@ -89,6 +89,10 @@ pub struct MessageObject {
download_state: DownloadState,
original_msg_id: Option<u32>,
saved_message_id: Option<u32>,
reactions: Option<JSONRPCReactions>,
vcard_contact: Option<VcardContact>,
@@ -253,6 +257,16 @@ impl MessageObject {
download_state,
original_msg_id: message
.get_original_msg_id(context)
.await?
.map(|id| id.to_u32()),
saved_message_id: message
.get_saved_msg_id(context)
.await?
.map(|id| id.to_u32()),
reactions,
vcard_contact: vcard_contacts.first().cloned(),