Make needs_encryption a bool

This commit is contained in:
Alexander Krotov
2019-12-15 18:49:03 +01:00
committed by holger krekel
parent a34ed5c02a
commit 697cc0a79b

View File

@@ -631,7 +631,7 @@ pub fn job_send_msg(context: &Context, msg_id: MsgId) -> Result<(), Error> {
msg.try_calc_and_set_dimensions(context).ok(); msg.try_calc_and_set_dimensions(context).ok();
/* create message */ /* create message */
let needs_encryption = msg.param.get_int(Param::GuaranteeE2ee).unwrap_or_default(); let needs_encryption = msg.param.get_bool(Param::GuaranteeE2ee).unwrap_or_default();
let attach_selfavatar = match chat::shall_attach_selfavatar(context, msg.chat_id) { let attach_selfavatar = match chat::shall_attach_selfavatar(context, msg.chat_id) {
Ok(attach_selfavatar) => attach_selfavatar, Ok(attach_selfavatar) => attach_selfavatar,
@@ -647,7 +647,7 @@ pub fn job_send_msg(context: &Context, msg_id: MsgId) -> Result<(), Error> {
err err
})?; })?;
if 0 != needs_encryption && !rendered_msg.is_encrypted { if needs_encryption && !rendered_msg.is_encrypted {
/* unrecoverable */ /* unrecoverable */
message::set_msg_failed( message::set_msg_failed(
context, context,
@@ -700,7 +700,7 @@ pub fn job_send_msg(context: &Context, msg_id: MsgId) -> Result<(), Error> {
} }
} }
if rendered_msg.is_encrypted && needs_encryption == 0 { if rendered_msg.is_encrypted && !needs_encryption {
msg.param.set_int(Param::GuaranteeE2ee, 1); msg.param.set_int(Param::GuaranteeE2ee, 1);
msg.save_param_to_disk(context); msg.save_param_to_disk(context);
} }