From f5bb899aa96cec174bcea13253eaf087bb5c89cb Mon Sep 17 00:00:00 2001 From: QuentinArguillere Date: Mon, 27 Jun 2022 11:42:24 +0200 Subject: [PATCH] Always display LDAP contacts in priority. If a local contact matches, partially or totally, the LDAP contact, still display both. --- Classes/MagicSearch.swift | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Classes/MagicSearch.swift b/Classes/MagicSearch.swift index 6d732e44d..65aa033b3 100644 --- a/Classes/MagicSearch.swift +++ b/Classes/MagicSearch.swift @@ -58,6 +58,11 @@ import linphonesw func searchAndAddMatchingContact(searchResult: SearchResult) -> Contact? { if let friend = searchResult.friend { + if (searchResult.sourceFlags == MagicSearchSource.LdapServers.rawValue), let newContact = Contact(friend: friend.getCobject) { + // Contact comes from LDAP, creating a new one + newContact.createdFromLdap = true + return newContact + } if let addr = friend.address, let foundContact = getContactFromAddr(addr: addr) { return foundContact } @@ -66,11 +71,6 @@ import linphonesw return foundContact } } - // No contacts found (searchResult likely comes from LDAP), creating a new one - if let newContact = Contact(friend: friend.getCobject) { - newContact.createdFromLdap = true - return newContact - } } if let addr = searchResult.address, let foundContact = getContactFromAddr(addr: addr) {