From f39abd6d51dc7b58fd8988c64dd8627784cb5a79 Mon Sep 17 00:00:00 2001 From: "B. Petersen" Date: Mon, 20 Jul 2020 15:01:25 +0200 Subject: [PATCH] correct summary for videochat-invites --- src/chat.rs | 5 +++-- src/constants.rs | 3 +++ src/message.rs | 7 +++++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/chat.rs b/src/chat.rs index f75468952..45d516e9a 100644 --- a/src/chat.rs +++ b/src/chat.rs @@ -1374,11 +1374,12 @@ pub(crate) fn msgtype_has_file(msgtype: Viewtype) -> bool { Viewtype::Voice => true, Viewtype::Video => true, Viewtype::File => true, + Viewtype::VideochatInvitation => false, } } async fn prepare_msg_blob(context: &Context, msg: &mut Message) -> Result<(), Error> { - if msg.viewtype == Viewtype::Text { + if msg.viewtype == Viewtype::Text || msg.viewtype == Viewtype::VideochatInvitation { // the caller should check if the message text is empty } else if msgtype_has_file(msg.viewtype) { let blob = msg @@ -1634,7 +1635,7 @@ pub async fn send_videochat_invitation(context: &Context, chat_id: ChatId) -> Re format!("{}{}", url, room) }; - let mut msg = Message::new(Viewtype::Text); + let mut msg = Message::new(Viewtype::VideochatInvitation); msg.text = Some( context .stock_string_repl_str(StockMessage::VideochatInviteMsgBody, url) diff --git a/src/constants.rs b/src/constants.rs index e6489547c..2e93f508e 100644 --- a/src/constants.rs +++ b/src/constants.rs @@ -296,6 +296,9 @@ pub enum Viewtype { /// The file is set via dc_msg_set_file() /// and retrieved via dc_msg_get_file(). File = 60, + + /// Message is an invitation to a videochat. + VideochatInvitation = 70, } impl Default for Viewtype { diff --git a/src/message.rs b/src/message.rs index 6c36ddeb2..050e6cd17 100644 --- a/src/message.rs +++ b/src/message.rs @@ -1249,6 +1249,13 @@ pub async fn get_summarytext_by_raw( format!("{} – {}", label, file_name) } } + Viewtype::VideochatInvitation => { + append_text = false; + context + .stock_str(StockMessage::VideochatInvitation) + .await + .into_owned() + } _ => { if param.get_cmd() != SystemMessage::LocationOnly { "".to_string()