jsonrpc: add webxdc_info property to Message (#3588)

* jsonrpc: add `webxdc_info` property to `Message`

* add pr number to changelog
This commit is contained in:
Simon Laux
2022-09-07 22:14:13 +02:00
committed by GitHub
parent 417bddfa16
commit 484aa54ed6
2 changed files with 11 additions and 0 deletions

View File

@@ -20,6 +20,7 @@
- `addContactToChat()`
- jsonrpc: add `is_broadcast` property to `ChatListItemFetchResult` #3584
- jsonrpc: add `was_seen_recently` property to `ChatListItemFetchResult`, `FullChat` and `Contact` #3584
- jsonrpc: add `webxdc_info` property to `Message` #3588
### Changes
- order contact lists by "last seen";

View File

@@ -10,6 +10,7 @@ use serde::Serialize;
use typescript_type_def::TypeDef;
use super::contact::ContactObject;
use super::webxdc::WebxdcMessageInfo;
#[derive(Serialize, TypeDef)]
#[serde(rename = "Message", rename_all = "camelCase")]
@@ -53,6 +54,8 @@ pub struct MessageObject {
file_mime: Option<String>,
file_bytes: u64,
file_name: Option<String>,
webxdc_info: Option<WebxdcMessageInfo>,
}
impl MessageObject {
@@ -70,6 +73,12 @@ impl MessageObject {
let file_bytes = message.get_filebytes(context).await;
let override_sender_name = message.get_override_sender_name();
let webxdc_info = if message.get_viewtype() == Viewtype::Webxdc {
Some(WebxdcMessageInfo::get_for_message(context, msg_id).await?)
} else {
None
};
Ok(MessageObject {
id: message_id,
chat_id: message.get_chat_id().to_u32(),
@@ -121,6 +130,7 @@ impl MessageObject {
file_mime: message.get_filemime(),
file_bytes,
file_name: message.get_filename(),
webxdc_info,
})
}
}