From 61fecd8c93244c7edc077c116d6ef240fe54004a Mon Sep 17 00:00:00 2001 From: Christophe Deschamps Date: Tue, 24 Jun 2025 12:23:23 +0200 Subject: [PATCH] Mark chatroom as read-only if it is not secure and account has mandatory encryption --- Linphone/core/chat/ChatCore.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Linphone/core/chat/ChatCore.cpp b/Linphone/core/chat/ChatCore.cpp index b35212e7..e955437b 100644 --- a/Linphone/core/chat/ChatCore.cpp +++ b/Linphone/core/chat/ChatCore.cpp @@ -97,7 +97,11 @@ ChatCore::ChatCore(const std::shared_ptr &chatRoom) : QObjec mIdentifier = Utils::coreStringToAppString(chatRoom->getIdentifier()); mChatRoomState = LinphoneEnums::fromLinphone(chatRoom->getState()); mIsEncrypted = chatRoom->hasCapability((int)linphone::ChatRoom::Capabilities::Encrypted); - mIsReadOnly = chatRoom->isReadOnly(); + auto localAccount = ToolModel::findAccount(chatRoom->getLocalAddress()); + bool associatedAccountHasIMEncryptionMandatory = + localAccount && localAccount->getParams() && + localAccount->getParams()->getInstantMessagingEncryptionMandatory(); + mIsReadOnly = chatRoom->isReadOnly() || (!mIsEncrypted && associatedAccountHasIMEncryptionMandatory); connect(this, &ChatCore::eventListChanged, this, &ChatCore::lUpdateLastMessage); connect(this, &ChatCore::eventsInserted, this, &ChatCore::lUpdateLastMessage); connect(this, &ChatCore::eventRemoved, this, &ChatCore::lUpdateLastMessage);