Commit 2fecb073 authored by Simon Morlat's avatar Simon Morlat

Optimize: don't search in friends if a Contact is found

parent f3c381b5
......@@ -291,18 +291,20 @@
+ (NSString *)displayNameForAddress:(const LinphoneAddress *)addr {
NSString *ret = NSLocalizedString(@"Unknown", nil);
Contact *contact = [FastAddressBook getContactWithAddress:addr];
LinphoneFriend *friend = linphone_core_find_friend(LC, addr);
if (contact) {
ret = [FastAddressBook displayNameForContact:contact];
} else if (friend) {
ret = [NSString stringWithUTF8String:linphone_friend_get_name(friend)];
} else {
const char *lDisplayName = linphone_address_get_display_name(addr);
const char *lUserName = linphone_address_get_username(addr);
if (lDisplayName) {
ret = [NSString stringWithUTF8String:lDisplayName];
} else if (lUserName) {
ret = [NSString stringWithUTF8String:lUserName];
LinphoneFriend *friend = linphone_core_find_friend(LC, addr);
if (friend) {
ret = [NSString stringWithUTF8String:linphone_friend_get_name(friend)];
} else {
const char *lDisplayName = linphone_address_get_display_name(addr);
const char *lUserName = linphone_address_get_username(addr);
if (lDisplayName) {
ret = [NSString stringWithUTF8String:lDisplayName];
} else if (lUserName) {
ret = [NSString stringWithUTF8String:lUserName];
}
}
}
return ret;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment