Change priority on display name display based on caller address (instead of call logs)

This commit is contained in:
Julien Wadel 2022-06-14 15:51:22 +02:00
parent ebd18851b5
commit 0225b8fa50
3 changed files with 26 additions and 11 deletions

View file

@ -8,11 +8,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Video conference.
- Log viewer.
- Option to set the display name in "using an account" tab of assistant.
- Long pressed buttons.
- Phone dialpad on main window.
### Fixed
- Crash on exit.
- Memory stability.
## 4.4.6 - 2022-06-14
###Fixed
- Crash when using no account.
- Show display name of the caller if it exists instead of call logs.
## 4.4.5 - 2022-06-06
### Fixed

View file

@ -718,7 +718,7 @@ void CallModel::searchReceived(std::list<std::shared_ptr<linphone::SearchResult>
}else{
if((*it)->getAddress()->weakEqual(mRemoteAddress)){
std::string newDisplayName = (*it)->getAddress()->getDisplayName();
if(!newDisplayName.empty())// Override only if there is one
if( ((*it)->getSourceFlags() & (int) linphone::MagicSearchSource::CallLogs) == 0 || newDisplayName.empty())
setRemoteDisplayName(newDisplayName);
found = true;
}

View file

@ -495,16 +495,21 @@ QString Utils::getDisplayName(const std::shared_ptr<const linphone::Address>& ad
if(model && model->getVcardModel())
displayName = model->getVcardModel()->getUsername();
else{
auto callHistory = CoreManager::getInstance()->getCore()->getCallLogs();
auto callLog = std::find_if(callHistory.begin(), callHistory.end(), [address](std::shared_ptr<linphone::CallLog>& cl){
return cl->getRemoteAddress()->weakEqual(address);
});
if(callLog != callHistory.end())
displayName = QString::fromStdString((*callLog)->getRemoteAddress()->getDisplayName());
if(displayName == "")
displayName = QString::fromStdString(address->getDisplayName());
if(displayName == "")
displayName = Utils::coreStringToAppString(address->getUsername());
// Try to get display from full address
displayName = QString::fromStdString(address->getDisplayName());
if( displayName == ""){
// Try to get display name from logs
auto callHistory = CoreManager::getInstance()->getCore()->getCallLogs();
auto callLog = std::find_if(callHistory.begin(), callHistory.end(), [address](std::shared_ptr<linphone::CallLog>& cl){
return cl->getRemoteAddress()->weakEqual(address);
});
if(callLog != callHistory.end())
displayName = QString::fromStdString((*callLog)->getRemoteAddress()->getDisplayName());
if(displayName == "")
displayName = QString::fromStdString(address->getDisplayName());
if(displayName == "")
displayName = Utils::coreStringToAppString(address->getUsername());
}
}
}
return displayName;