From 1dd9dcab7e53dafae0bb58f9c2ac3492afa4a3bd Mon Sep 17 00:00:00 2001 From: Julien Wadel Date: Tue, 9 Nov 2021 13:32:35 +0100 Subject: [PATCH] Recent contacts in group chat creation : ignore GroupChat capability if no friends with it has been found. --- CHANGELOG.md | 1 + .../components/timeline/TimelineListModel.cpp | 23 +++++++++++-------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8dc6b2dd3..6e78cc41c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Unblock secure group chat activation. - Unselect current contact if history call view is displayed. - Show chat actions in history view +- Group chat creation : If no groupchat capabilities has been found in recent contacts, ignore test on capability and display them. ## 4.3.1 - 2021-11-04 diff --git a/linphone-app/src/components/timeline/TimelineListModel.cpp b/linphone-app/src/components/timeline/TimelineListModel.cpp index 272e11b85..62964e68d 100644 --- a/linphone-app/src/components/timeline/TimelineListModel.cpp +++ b/linphone-app/src/components/timeline/TimelineListModel.cpp @@ -154,24 +154,27 @@ std::shared_ptr TimelineListModel::getTimeline(std::shared_ptr
  • sortedData; - int count = 0; - QDateTime currentDateTime = QDateTime::currentDateTime(); + bool doTest = true; for(auto timeline : mTimelines){ auto chatRoom = timeline->getChatRoomModel(); - if(chatRoom && chatRoom->isCurrentProxy() && !chatRoom->isGroupEnabled() && !chatRoom->haveEncryption()) { + if(chatRoom && chatRoom->isCurrentProxy() && chatRoom->isOneToOne() && !chatRoom->haveEncryption()) { sortedData.insert(chatRoom->mLastUpdateTime.secsTo(currentDateTime),chatRoom); } } - for(auto contact : sortedData){ - if(Utils::hasCapability(contact->getFullPeerAddress(), LinphoneEnums::FriendCapabilityGroupChat) ) { - ++count; - contacts << QVariant::fromValue(contact); - if(count >= maxCount) - return contacts; + do{ + int count = 0; + for(auto contact : sortedData){ + if(!doTest || Utils::hasCapability(contact->getFullPeerAddress(), LinphoneEnums::FriendCapabilityGroupChat) ) { + ++count; + contacts << QVariant::fromValue(contact); + if(count >= maxCount) + return contacts; + } } - } + doTest = false; + }while( contacts.size() == 0 && sortedData.size() > 0);// no friends capability have been found : take contacts without testing capabilities. return contacts; }