Derive and use Display trait for Viewtype

This commit is contained in:
Dmitry Bogatov
2019-07-30 08:52:43 +00:00
parent c04c8ff103
commit 3358d09148
3 changed files with 15 additions and 22 deletions

View File

@@ -179,15 +179,7 @@ pub unsafe fn dc_get_msg_info(context: &Context, msg_id: u32) -> *mut libc::c_ch
if (*msg).type_0 != Viewtype::Text {
ret += "Type: ";
match (*msg).type_0 {
Viewtype::Audio => ret += "Audio",
Viewtype::File => ret += "File",
Viewtype::Gif => ret += "GIF",
Viewtype::Image => ret += "Image",
Viewtype::Video => ret += "Video",
Viewtype::Voice => ret += "Voice",
_ => ret += &format!("{}", (*msg).type_0),
}
ret += &format!("{}", (*msg).type_0);
ret += "\n";
p = dc_msg_get_filemime(msg);
ret += &format!("Mimetype: {}\n", as_str(p));