diff --git a/coreapi/friend.c b/coreapi/friend.c index a427db250..9c929e225 100644 --- a/coreapi/friend.c +++ b/coreapi/friend.c @@ -1134,7 +1134,7 @@ void linphone_friend_destroy(LinphoneFriend *lf) { linphone_friend_unref(lf); } -LinphoneVcard* linphone_friend_get_vcard(LinphoneFriend *fr) { +LinphoneVcard* linphone_friend_get_vcard(const LinphoneFriend *fr) { if (fr && linphone_core_vcard_supported()) return fr->vcard; return NULL; } diff --git a/include/linphone/friend.h b/include/linphone/friend.h index 6daca4a15..8514efc79 100644 --- a/include/linphone/friend.h +++ b/include/linphone/friend.h @@ -306,7 +306,7 @@ LINPHONE_PUBLIC LinphoneCore *linphone_friend_get_core(const LinphoneFriend *fr) * Returns the vCard object associated to this friend, if any * @param[in] fr LinphoneFriend object */ -LINPHONE_PUBLIC LinphoneVcard* linphone_friend_get_vcard(LinphoneFriend *fr); +LINPHONE_PUBLIC LinphoneVcard* linphone_friend_get_vcard(const LinphoneFriend *fr); /** * Binds a vCard object to a friend diff --git a/src/search/magic-search.cpp b/src/search/magic-search.cpp index ad8b7cf22..13ebc6e41 100644 --- a/src/search/magic-search.cpp +++ b/src/search/magic-search.cpp @@ -221,12 +221,14 @@ SearchResult MagicSearch::searchInFriend(const LinphoneFriend *lFriend, const st if (!checkDomain(lFriend, lAddress, withDomain)) return SearchResult(weight, nullptr); // NAME - if (linphone_friend_get_name(lFriend) != nullptr) { - weight += getWeight(linphone_friend_get_name(lFriend), filter); + if (linphone_core_vcard_supported()) { + if (linphone_friend_get_vcard(lFriend)) { + weight += getWeight(linphone_vcard_get_full_name(linphone_friend_get_vcard(lFriend)), filter) * 3; + } } //SIP URI - weight += searchInAddress(lAddress, filter, withDomain); + weight += searchInAddress(lAddress, filter, withDomain) * 1; // PHONE NUMBER bctbx_list_t *begin, *phoneNumbers = linphone_friend_get_phone_numbers(lFriend); @@ -236,7 +238,7 @@ SearchResult MagicSearch::searchInFriend(const LinphoneFriend *lFriend, const st const LinphonePresenceModel *presence = linphone_friend_get_presence_model_for_uri_or_tel(lFriend, number.c_str()); weight += getWeight(number, filter); if (presence != nullptr) { - weight += getWeight(linphone_presence_model_get_contact(presence), filter); + weight += getWeight(linphone_presence_model_get_contact(presence), filter) * 2; } phoneNumbers = phoneNumbers->next; }