From 0913df3ac814700469556dd8609ab498a0f874c1 Mon Sep 17 00:00:00 2001 From: Christophe Deschamps Date: Wed, 8 Feb 2023 16:19:27 +0100 Subject: [PATCH] Hide non secure contacts when creating chatroom and lime is forced --- Classes/ChatConversationCreateTableView.m | 11 +++++++++++ Classes/ChatConversationCreateView.m | 2 ++ 2 files changed, 13 insertions(+) diff --git a/Classes/ChatConversationCreateTableView.m b/Classes/ChatConversationCreateTableView.m index e53c818e3..f02068d4b 100644 --- a/Classes/ChatConversationCreateTableView.m +++ b/Classes/ChatConversationCreateTableView.m @@ -97,6 +97,13 @@ _loadingView.hidden = TRUE; } +-(BOOL) isSecureChatable:(const LinphoneFriend*)friend { + if (!friend) + return false; + const LinphonePresenceModel *model = linphone_friend_get_presence_model(friend); + return model && linphone_presence_model_has_capability(model, LinphoneFriendCapabilityLimeX3dh); +} + - (void) buildChatContactTable { bctbx_list_t *result_list = [MagicSearchSingleton.instance getLastSearchResults]; @@ -109,6 +116,10 @@ const LinphoneFriend* friend = linphone_search_result_get_friend(result); const char *phoneNumber = linphone_search_result_get_phone_number(result); + if ([LinphoneManager.instance lpConfigBoolForKey:@"force_lime_chat_rooms"] && ![self isSecureChatable:friend]) { + continue; + } + Contact *contact = nil; char *uri = nil; NSString *address = nil; diff --git a/Classes/ChatConversationCreateView.m b/Classes/ChatConversationCreateView.m index aac3b4eaa..9f5f69006 100644 --- a/Classes/ChatConversationCreateView.m +++ b/Classes/ChatConversationCreateView.m @@ -110,6 +110,8 @@ static UICompositeViewDescription *compositeDescription = nil; _isEncrypted = true; _tableController.isEncrypted = true; _allButton.hidden = true; + _linphoneButton.hidden = true; + _selectedButtonImage.hidden = true; } if (_isForVoipConference) {