mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-02-02 20:29:23 +00:00
show accounts display name instead of username.
This commit is contained in:
parent
2fb69d9fd6
commit
3f78a44946
1 changed files with 24 additions and 11 deletions
|
|
@ -549,17 +549,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