mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-24 07:08:07 +00:00
Recent contacts in group chat creation : ignore GroupChat capability if no friends with it has been found.
This commit is contained in:
parent
c8da534e96
commit
1dd9dcab7e
2 changed files with 14 additions and 10 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -154,24 +154,27 @@ std::shared_ptr<TimelineModel> TimelineListModel::getTimeline(std::shared_ptr<li
|
|||
QVariantList TimelineListModel::getLastChatRooms(const int& maxCount) const{
|
||||
QVariantList contacts;
|
||||
QMultiMap<qint64, ChatRoomModel*> 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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue