From 865b14f4ebf1cb8ef7e3180a64d08553f5d967ed Mon Sep 17 00:00:00 2001 From: Julien Wadel Date: Mon, 4 Jul 2022 10:53:17 +0200 Subject: [PATCH] Remove fallback displayname on logs and chat rooms. Add a printObject() for javascript variables. --- CHANGELOG.md | 5 +++++ linphone-app/src/components/call/CallModel.cpp | 18 +++++++++++++----- linphone-app/ui/scripts/Utils/utils.js | 9 +++++++++ 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2aa80bf22..e6bc28115 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Crash on exit. - Memory stability. +## 4.4.8 - 2022-07-04 + +### Fixes +- Display name are based on friends (coming from local or LDAP server) and caller address only. + ## 4.4.7 - 2022-07-01 ### Fixes diff --git a/linphone-app/src/components/call/CallModel.cpp b/linphone-app/src/components/call/CallModel.cpp index 0aba6e5c5..e871d395a 100644 --- a/linphone-app/src/components/call/CallModel.cpp +++ b/linphone-app/src/components/call/CallModel.cpp @@ -83,7 +83,7 @@ CallModel::CallModel (shared_ptr call){ mMagicSearch->addListener(mSearch); mRemoteAddress = mCall->getRemoteAddress()->clone(); - mMagicSearch->getContactListFromFilterAsync(mRemoteAddress->getUsername(),mRemoteAddress->getDomain()); + mMagicSearch->getContactsListAsync(mRemoteAddress->getUsername(),mRemoteAddress->getDomain(), (int)linphone::MagicSearchSource::LdapServers | (int)linphone::MagicSearchSource::Friends, linphone::MagicSearchAggregation::Friend); } CallModel::~CallModel () { @@ -707,10 +707,11 @@ void CallModel::toggleSpeakerMute(){ // ----------------------------------------------------------------------------- // Set remote display name when a search has been done +// Local Friend > LDAP friend > Address > others void CallModel::searchReceived(std::list> results){ bool found = false; for(auto it = results.begin() ; it != results.end() && !found ; ++it){ - if((*it)->getFriend()){ + if((*it)->getFriend()){// Local Friend if((*it)->getFriend()->getAddress()->weakEqual(mRemoteAddress)){ setRemoteDisplayName((*it)->getFriend()->getName()); found = true; @@ -718,9 +719,16 @@ void CallModel::searchReceived(std::list }else{ if((*it)->getAddress()->weakEqual(mRemoteAddress)){ std::string newDisplayName = (*it)->getAddress()->getDisplayName(); - if( ((*it)->getSourceFlags() & (int) linphone::MagicSearchSource::CallLogs) == 0 || newDisplayName.empty()) - setRemoteDisplayName(newDisplayName); - found = true; + if(!newDisplayName.empty()){ + // LDAP friend + if( ((*it)->getSourceFlags() & (int) linphone::MagicSearchSource::LdapServers) == (int) linphone::MagicSearchSource::LdapServers){ + setRemoteDisplayName(newDisplayName); + found = true; + }else if( Utils::coreStringToAppString(mRemoteAddress->getDisplayName()).isEmpty()){ + setRemoteDisplayName(newDisplayName); + found = true; + } + } } } } diff --git a/linphone-app/ui/scripts/Utils/utils.js b/linphone-app/ui/scripts/Utils/utils.js index 53085ae58..782d9d8bb 100644 --- a/linphone-app/ui/scripts/Utils/utils.js +++ b/linphone-app/ui/scripts/Utils/utils.js @@ -693,3 +693,12 @@ function write (fileName, text) { request.open('PUT', getUriFromSystemPath(fileName), false) request.send(text) } + +function printObject(o) { + var out = ''; + for (var p in o) { + out += p + ': ' + o[p] + '\n'; + } + return out; +} +