From 589236c27b1de2c70b98d50941e17bd0cfb7c787 Mon Sep 17 00:00:00 2001 From: iequidoo Date: Tue, 16 Jan 2024 02:54:49 -0300 Subject: [PATCH] fix: chat::send_msg: Remove encryption-related params from already sent message This allows to send existing messages (incoming and outgoing) taken from encrypted chats, to unencrypted ones. `Param::ForcePlaintext` is removed as well -- if a message can be sent encrypted this time, nothing bad with this. --- src/chat.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/chat.rs b/src/chat.rs index 88f3b4b57..fd921dd92 100644 --- a/src/chat.rs +++ b/src/chat.rs @@ -2657,6 +2657,11 @@ pub async fn send_msg(context: &Context, chat_id: ChatId, msg: &mut Message) -> return send_msg_inner(context, chat_id, msg).await; } + if msg.state != MessageState::Undefined && msg.state != MessageState::OutPreparing { + msg.param.remove(Param::GuaranteeE2ee); + msg.param.remove(Param::ForcePlaintext); + msg.update_param(context).await?; + } send_msg_inner(context, chat_id, msg).await }