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,6 +126,7 @@ 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";
|
||||
|
|
@ -144,12 +145,12 @@ std::shared_ptr<linphone::Friend> ToolModel::findFriendByAddress(std::shared_ptr
|
|||
}
|
||||
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…
Reference in a new issue