update sdk (fix on ldap friends in magic search)
This commit is contained in:
parent
a2e6549204
commit
9c89394631
3 changed files with 5 additions and 24 deletions
|
|
@ -75,34 +75,12 @@ void MagicSearchModel::setMaxResults(int maxResults) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isContactTemporary(std::shared_ptr<linphone::Friend> f, bool allowNullFriendList = false) {
|
|
||||||
auto friendList = f ? f->getFriendList() : nullptr;
|
|
||||||
if (friendList == nullptr && !allowNullFriendList) return true;
|
|
||||||
return friendList && (friendList == ToolModel::getLdapFriendList());
|
|
||||||
}
|
|
||||||
|
|
||||||
void MagicSearchModel::onSearchResultsReceived(const std::shared_ptr<linphone::MagicSearch> &magicSearch) {
|
void MagicSearchModel::onSearchResultsReceived(const std::shared_ptr<linphone::MagicSearch> &magicSearch) {
|
||||||
auto results = magicSearch->getLastSearch();
|
auto results = magicSearch->getLastSearch();
|
||||||
qInfo() << log().arg("SDK send callback: onSearchResultsReceived : %1 results.").arg(results.size());
|
qInfo() << log().arg("SDK send callback: onSearchResultsReceived : %1 results.").arg(results.size());
|
||||||
auto appFriends = ToolModel::getAppFriendList();
|
auto appFriends = ToolModel::getAppFriendList();
|
||||||
auto ldapFriends = ToolModel::getLdapFriendList();
|
auto ldapFriends = ToolModel::getLdapFriendList();
|
||||||
std::list<std::shared_ptr<linphone::SearchResult>> finalResults;
|
emit searchResultsReceived(results);
|
||||||
for (auto result : results) {
|
|
||||||
auto f = result->getFriend();
|
|
||||||
auto sourceFlags = result->getSourceFlags();
|
|
||||||
qInfo() << "result" << result->getAddress()->asStringUriOnly();
|
|
||||||
qInfo() << "result has flag friend" << result->hasSourceFlag(linphone::MagicSearch::Source::Friends) << ((sourceFlags & (int)linphone::MagicSearch::Source::Friends) != 0);
|
|
||||||
qInfo() << "result has flag ldap" << result->hasSourceFlag(linphone::MagicSearch::Source::LdapServers) << ((sourceFlags & (int)linphone::MagicSearch::Source::LdapServers) != 0);
|
|
||||||
qInfo() << "result has flag carddav" << result->hasSourceFlag(linphone::MagicSearch::Source::RemoteCardDAV) << ((sourceFlags & (int)linphone::MagicSearch::Source::RemoteCardDAV) != 0);
|
|
||||||
bool isFromRemoteDirectory = ((sourceFlags & (int)linphone::MagicSearch::Source::LdapServers) != 0) ||
|
|
||||||
((sourceFlags & (int)linphone::MagicSearch::Source::RemoteCardDAV) != 0);
|
|
||||||
if (!isFromRemoteDirectory && isContactTemporary(f, true)) {
|
|
||||||
qInfo() << "Do not show friend " << f->getName() << "which is not remote and is in a temporary friend list";
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
finalResults.push_back(result);
|
|
||||||
}
|
|
||||||
emit searchResultsReceived(finalResults);
|
|
||||||
for (auto result : results) {
|
for (auto result : results) {
|
||||||
auto f = result->getFriend();
|
auto f = result->getFriend();
|
||||||
auto fList = f ? f->getFriendList() : nullptr;
|
auto fList = f ? f->getFriendList() : nullptr;
|
||||||
|
|
|
||||||
|
|
@ -327,6 +327,9 @@ std::shared_ptr<linphone::FriendList> ToolModel::getFriendList(const std::string
|
||||||
if (!friendList) {
|
if (!friendList) {
|
||||||
friendList = core->createFriendList();
|
friendList = core->createFriendList();
|
||||||
friendList->setDisplayName(listName);
|
friendList->setDisplayName(listName);
|
||||||
|
if (listName == "ldap_friends") {
|
||||||
|
friendList->setType(linphone::FriendList::Type::ApplicationCache);
|
||||||
|
}
|
||||||
core->addFriendList(friendList);
|
core->addFriendList(friendList);
|
||||||
}
|
}
|
||||||
return friendList;
|
return friendList;
|
||||||
|
|
|
||||||
2
external/linphone-sdk
vendored
2
external/linphone-sdk
vendored
|
|
@ -1 +1 @@
|
||||||
Subproject commit 2e719fab6db0f0d52c156c244602d1375702bcd6
|
Subproject commit 07c52d296e822ea6e3b0fac31c91a778a7272d72
|
||||||
Loading…
Reference in a new issue