Skip to content

Commit 3ad9cf3

Browse files
authored
Add getWebxdcHref to json api (#6281)
1 parent 8ffe864 commit 3ad9cf3

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

deltachat-jsonrpc/src/api.rs

+13-1
Original file line numberDiff line numberDiff line change
@@ -1767,7 +1767,7 @@ impl CommandApi {
17671767
account_id: u32,
17681768
instance_msg_id: u32,
17691769
update_str: String,
1770-
_descr: String,
1770+
_descr: Option<String>,
17711771
) -> Result<()> {
17721772
let ctx = self.get_context(account_id).await?;
17731773
ctx.send_webxdc_status_update(MsgId::new(instance_msg_id), &update_str)
@@ -1829,6 +1829,18 @@ impl CommandApi {
18291829
WebxdcMessageInfo::get_for_message(&ctx, MsgId::new(instance_msg_id)).await
18301830
}
18311831

1832+
/// Get href from a WebxdcInfoMessage which might include a hash holding
1833+
/// information about a specific position or state in a webxdc app (optional)
1834+
async fn get_webxdc_href(
1835+
&self,
1836+
account_id: u32,
1837+
instance_msg_id: u32,
1838+
) -> Result<Option<String>> {
1839+
let ctx = self.get_context(account_id).await?;
1840+
let message = Message::load_from_db(&ctx, MsgId::new(instance_msg_id)).await?;
1841+
Ok(message.get_webxdc_href())
1842+
}
1843+
18321844
/// Get blob encoded as base64 from a webxdc message
18331845
///
18341846
/// path is the path of the file within webxdc archive

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

+6
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ pub struct MessageObject {
8585

8686
webxdc_info: Option<WebxdcMessageInfo>,
8787

88+
webxdc_href: Option<String>,
89+
8890
download_state: DownloadState,
8991

9092
reactions: Option<JSONRPCReactions>,
@@ -241,6 +243,10 @@ impl MessageObject {
241243
file_name: message.get_filename(),
242244
webxdc_info,
243245

246+
// On a WebxdcInfoMessage this might include a hash holding
247+
// information about a specific position or state in a webxdc app
248+
webxdc_href: message.get_webxdc_href(),
249+
244250
download_state,
245251

246252
reactions,

0 commit comments

Comments
 (0)