Use ForcePlaintext as enum, not i32

This commit is contained in:
Alexander Krotov
2020-09-06 03:42:45 +03:00
committed by link2xt
parent a7178f4f25
commit 6fcc589655
3 changed files with 35 additions and 10 deletions

View File

@@ -842,7 +842,13 @@ impl Chat {
/* check if we want to encrypt this message. If yes and circumstances change
so that E2EE is no longer available at a later point (reset, changed settings),
we might not send the message out at all */
if msg.param.get_int(Param::ForcePlaintext).unwrap_or_default() == 0 {
if msg
.param
.get_int(Param::ForcePlaintext)
.and_then::<ForcePlaintext, _>(num_traits::FromPrimitive::from_i32)
.unwrap_or_default()
== ForcePlaintext::Dont
{
let mut can_encrypt = true;
let mut all_mutual = context.get_config_bool(Config::E2eeEnabled).await;