Skip to content

Commit c87c241

Browse files
committed
Encrypted contacts must go to encrypted chats
1 parent 968ec88 commit c87c241

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/chat.rs

+4
Original file line numberDiff line numberDiff line change
@@ -3884,6 +3884,10 @@ pub(crate) async fn add_contact_to_chat_ex(
38843884
chat.typ != Chattype::Broadcast || contact_id != ContactId::SELF,
38853885
"Cannot add SELF to broadcast."
38863886
);
3887+
ensure!(
3888+
chat.is_encrypted(context).await? == contact.is_pgp_contact(),
3889+
"Only PGP-contacts can be added to encrypted chats"
3890+
);
38873891

38883892
if !chat.is_self_in_chat(context).await? {
38893893
context.emit_event(EventType::ErrorSelfNotInGroup(

0 commit comments

Comments
 (0)