mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-17 11:28:07 +00:00
try to improve friend research (clean address before insertion in map)
This commit is contained in:
parent
dad3cb084f
commit
c0dbc4b0e5
2 changed files with 10 additions and 8 deletions
|
|
@ -87,8 +87,9 @@ void MagicSearchModel::onSearchResultsReceived(const std::shared_ptr<linphone::M
|
|||
auto friendsManager = FriendsManager::getInstance();
|
||||
if (f) {
|
||||
qDebug() << "friend exists, append to unknown map";
|
||||
auto friendAddress = f->getAddress();
|
||||
friendsManager->appendUnknownFriend(friendAddress->clone(), f);
|
||||
auto friendAddress = f->getAddress()->clone();
|
||||
friendAddress->clean();
|
||||
friendsManager->appendUnknownFriend(friendAddress, f);
|
||||
if (friendsManager->isInOtherAddresses(Utils::coreStringToAppString(friendAddress->asStringUriOnly()))) {
|
||||
friendsManager->removeOtherAddress(Utils::coreStringToAppString(friendAddress->asStringUriOnly()));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -126,12 +126,13 @@ std::shared_ptr<linphone::Friend> ToolModel::findFriendByAddress(const QString &
|
|||
|
||||
std::shared_ptr<linphone::Friend> ToolModel::findFriendByAddress(std::shared_ptr<linphone::Address> linphoneAddr) {
|
||||
auto friendsManager = FriendsManager::getInstance();
|
||||
linphoneAddr->clean();
|
||||
QString key = Utils::coreStringToAppString(linphoneAddr->asStringUriOnly());
|
||||
if (friendsManager->isInKnownFriends(key)) {
|
||||
// qDebug() << key << "have been found in known friend, return it";
|
||||
// qDebug() << key << "have been found in known friend, return it";
|
||||
return friendsManager->getKnownFriendAtKey(key);
|
||||
} else if (friendsManager->isInUnknownFriends(key)) {
|
||||
// qDebug() << key << "have been found in unknown friend, return it";
|
||||
// qDebug() << key << "have been found in unknown friend, return it";
|
||||
return friendsManager->getUnknownFriendAtKey(key);
|
||||
}
|
||||
auto f = CoreModel::getInstance()->getCore()->findFriend(linphoneAddr);
|
||||
|
|
@ -139,17 +140,17 @@ std::shared_ptr<linphone::Friend> ToolModel::findFriendByAddress(std::shared_ptr
|
|||
if (friendsManager->isInUnknownFriends(key)) {
|
||||
friendsManager->removeUnknownFriend(key);
|
||||
}
|
||||
// qDebug() << "found friend, add to known map";
|
||||
// qDebug() << "found friend, add to known map";
|
||||
friendsManager->appendKnownFriend(linphoneAddr, f);
|
||||
}
|
||||
if (!f) {
|
||||
if (friendsManager->isInOtherAddresses(key)) {
|
||||
// qDebug() << "A magic search has already be done for address" << key << "and nothing was found,
|
||||
// return";
|
||||
// qDebug() << "A magic search has already be done for address" << key << "and nothing was found,return ";
|
||||
return nullptr;
|
||||
}
|
||||
friendsManager->appendOtherAddress(key);
|
||||
// qDebug() << "Couldn't find friend" << linphoneAddr->asStringUriOnly() << "in core, use magic search";
|
||||
if (CoreModel::getInstance()->getCore()->getRemoteContactDirectories().empty()) return nullptr;
|
||||
qDebug() << "Couldn't find friend" << linphoneAddr->asStringUriOnly() << "in core or in maps, use magic search";
|
||||
CoreModel::getInstance()->searchInMagicSearch(Utils::coreStringToAppString(linphoneAddr->asStringUriOnly()),
|
||||
(int)linphone::MagicSearch::Source::LdapServers |
|
||||
(int)linphone::MagicSearch::Source::RemoteCardDAV,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue