Skip to content

Commit e0dfba8

Browse files
authored
feat: save messages API in JSON RPC (#6554)
relates to deltachat/deltachat-desktop#4596
1 parent 0f449cc commit e0dfba8

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

deltachat-jsonrpc/src/api.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1305,6 +1305,12 @@ impl CommandApi {
13051305
Ok(results)
13061306
}
13071307

1308+
async fn save_msgs(&self, account_id: u32, message_ids: Vec<u32>) -> Result<()> {
1309+
let ctx = self.get_context(account_id).await?;
1310+
let message_ids: Vec<MsgId> = message_ids.into_iter().map(MsgId::new).collect();
1311+
chat::save_msgs(&ctx, &message_ids).await
1312+
}
1313+
13081314
// ---------------------------------------------
13091315
// contact
13101316
// ---------------------------------------------

deltachat-jsonrpc/src/api/types/message.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,10 @@ pub struct MessageObject {
8989

9090
download_state: DownloadState,
9191

92+
original_msg_id: Option<u32>,
93+
94+
saved_message_id: Option<u32>,
95+
9296
reactions: Option<JSONRPCReactions>,
9397

9498
vcard_contact: Option<VcardContact>,
@@ -253,6 +257,16 @@ impl MessageObject {
253257

254258
download_state,
255259

260+
original_msg_id: message
261+
.get_original_msg_id(context)
262+
.await?
263+
.map(|id| id.to_u32()),
264+
265+
saved_message_id: message
266+
.get_saved_msg_id(context)
267+
.await?
268+
.map(|id| id.to_u32()),
269+
256270
reactions,
257271

258272
vcard_contact: vcard_contacts.first().cloned(),

0 commit comments

Comments
 (0)