Skip to content

Commit

Permalink
fix: chat::send_msg: Remove encryption-related params from already se…
Browse files Browse the repository at this point in the history
…nt 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.
  • Loading branch information
iequidoo committed Jan 16, 2024
1 parent fe005f8 commit e2e8a8d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/chat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit e2e8a8d

Please sign in to comment.