mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-17 11:28:07 +00:00
Show local accounts display name instead of username.
This commit is contained in:
parent
b13e88b523
commit
66982bd0c3
2 changed files with 25 additions and 11 deletions
|
|
@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
### Fixed
|
||||
- Crash on chat rooms with default account.
|
||||
- Show display name for local accounts.
|
||||
|
||||
## 5.0.12 - 2023-03-01
|
||||
|
||||
|
|
|
|||
|
|
@ -538,17 +538,30 @@ QString Utils::getDisplayName(const std::shared_ptr<const linphone::Address>& ad
|
|||
// 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());
|
||||
// Try to get display name from proxies
|
||||
auto accounts = CoreManager::getInstance()->getCore()->getAccountList();
|
||||
for(auto accountIt = accounts.begin() ; displayName=="" && accountIt != accounts.end() ; ++accountIt){
|
||||
auto params = accountIt->get()->getParams();
|
||||
if(params){
|
||||
auto accountAddress = params->getIdentityAddress();
|
||||
if(accountAddress && accountAddress->weakEqual(address)){
|
||||
displayName = Utils::coreStringToAppString(accountAddress->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());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue