mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-30 01:39:20 +00:00
Adding different coef for weight by type in magic search
This commit is contained in:
parent
71f5e47cff
commit
d0c1259dda
3 changed files with 8 additions and 6 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue