mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-20 12:38:09 +00:00
frienlist.c: fix sort (use display name when available)
This commit is contained in:
parent
489c03a89c
commit
bd503ea852
2 changed files with 14 additions and 8 deletions
|
|
@ -611,7 +611,7 @@ static int get_friend_weight(const LinphoneFriend *lf){
|
|||
}
|
||||
|
||||
static int friend_compare_func(const LinphoneFriend *lf1, const LinphoneFriend *lf2){
|
||||
int w1,w2;
|
||||
int w1,w2,ret;
|
||||
w1=get_friend_weight(lf1);
|
||||
w2=get_friend_weight(lf2);
|
||||
if (w1==w2){
|
||||
|
|
@ -619,13 +619,19 @@ static int friend_compare_func(const LinphoneFriend *lf1, const LinphoneFriend *
|
|||
const LinphoneAddress *addr1,*addr2;
|
||||
addr1=linphone_friend_get_address(lf1);
|
||||
addr2=linphone_friend_get_address(lf2);
|
||||
u1=linphone_address_get_username(addr1);
|
||||
u2=linphone_address_get_username(addr2);
|
||||
if (u1 && u2) return strcasecmp(u1,u2);
|
||||
if (u1) return 1;
|
||||
else return -1;
|
||||
u1=linphone_address_get_display_name(addr1) ? linphone_address_get_display_name(addr1) : linphone_address_get_username(addr1);
|
||||
u2=linphone_address_get_display_name(addr2) ? linphone_address_get_display_name(addr2) : linphone_address_get_username(addr2);
|
||||
if (u1 && u2) {
|
||||
ret = strcasecmp(u1,u2);
|
||||
} else if (u1) {
|
||||
ret = 1;
|
||||
} else {
|
||||
ret = -1;
|
||||
}
|
||||
} else {
|
||||
ret = w2-w1;
|
||||
}
|
||||
return w2-w1;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static bctbx_list_t *sort_friend_list(const bctbx_list_t *friends){
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 2204eb636cbc05aea0da923881e2ea3bdd795587
|
||||
Subproject commit 2f39b407c0291b7b36e8cd061f33d057bf2e1178
|
||||
Loading…
Add table
Reference in a new issue