Skip to content

Commit

Permalink
feat: save messages API in JSON RPC (#6554)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicodh authored Feb 18, 2025
1 parent 0f449cc commit e0dfba8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
6 changes: 6 additions & 0 deletions deltachat-jsonrpc/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
// ---------------------------------------------
Expand Down
14 changes: 14 additions & 0 deletions deltachat-jsonrpc/src/api/types/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>,
Expand Down Expand Up @@ -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(),
Expand Down

0 comments on commit e0dfba8

Please sign in to comment.