mirror of
https://github.com/chatmail/core.git
synced 2026-05-05 14:26:30 +03:00
feat: save messages API in JSON RPC (#6554)
relates to https://github.com/deltachat/deltachat-desktop/issues/4596
This commit is contained in:
@@ -1305,6 +1305,12 @@ impl CommandApi {
|
|||||||
Ok(results)
|
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
|
// contact
|
||||||
// ---------------------------------------------
|
// ---------------------------------------------
|
||||||
|
|||||||
@@ -89,6 +89,10 @@ pub struct MessageObject {
|
|||||||
|
|
||||||
download_state: DownloadState,
|
download_state: DownloadState,
|
||||||
|
|
||||||
|
original_msg_id: Option<u32>,
|
||||||
|
|
||||||
|
saved_message_id: Option<u32>,
|
||||||
|
|
||||||
reactions: Option<JSONRPCReactions>,
|
reactions: Option<JSONRPCReactions>,
|
||||||
|
|
||||||
vcard_contact: Option<VcardContact>,
|
vcard_contact: Option<VcardContact>,
|
||||||
@@ -253,6 +257,16 @@ impl MessageObject {
|
|||||||
|
|
||||||
download_state,
|
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,
|
reactions,
|
||||||
|
|
||||||
vcard_contact: vcard_contacts.first().cloned(),
|
vcard_contact: vcard_contacts.first().cloned(),
|
||||||
|
|||||||
Reference in New Issue
Block a user