correct summary for videochat-invites

This commit is contained in:
B. Petersen
2020-07-20 15:01:25 +02:00
parent 4227dec127
commit f39abd6d51
3 changed files with 13 additions and 2 deletions

View File

@@ -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)

View File

@@ -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 {

View File

@@ -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()