forked from mirrors/linphone-iphone
optimize displayNameForContact
This commit is contained in:
parent
3ae3090e7f
commit
6e95fd9db4
2 changed files with 10 additions and 5 deletions
|
|
@ -33,7 +33,12 @@
|
|||
if (!_friend) {
|
||||
_friend = linphone_friend_ref(linphone_core_create_friend(LC));
|
||||
linphone_friend_set_ref_key(_friend, key);
|
||||
linphone_friend_set_name(_friend, [NSString stringWithFormat:@"%@ %@", _firstName, _lastName].UTF8String);
|
||||
linphone_friend_set_name(
|
||||
_friend,
|
||||
[NSString
|
||||
stringWithFormat:@"%@%@", _firstName ? _firstName : @"",
|
||||
_lastName ? [_firstName ? @" " : @"" stringByAppendingString:_lastName] : @""]
|
||||
.UTF8String);
|
||||
for (NSString* sipAddr in _sipAddresses) {
|
||||
LinphoneAddress* addr = linphone_core_interpret_url(LC, sipAddr.UTF8String);
|
||||
if (addr) {
|
||||
|
|
@ -100,9 +105,10 @@
|
|||
|
||||
- (NSString *)displayName {
|
||||
if (_friend) {
|
||||
// const char *dp = linphone_address_get_display_name(linphone_friend_get_address(_friend));
|
||||
//if (dp)
|
||||
// return [NSString stringWithUTF8String:dp];
|
||||
const char *friend_name = linphone_friend_get_name(_friend);
|
||||
if (friend_name) {
|
||||
return [NSString stringWithUTF8String:friend_name];
|
||||
}
|
||||
}
|
||||
|
||||
if (_person != nil) {
|
||||
|
|
|
|||
|
|
@ -305,7 +305,6 @@ void sync_address_book(ABAddressBookRef addressBook, CFDictionaryRef info, void
|
|||
ret = [FastAddressBook displayNameForContact:contact];
|
||||
} else if (friend) {
|
||||
ret = [NSString stringWithUTF8String:linphone_friend_get_name(friend)];
|
||||
ret = [ret stringByReplacingOccurrencesOfString:@"(null)" withString:@""];
|
||||
} else {
|
||||
const char *lDisplayName = linphone_address_get_display_name(addr);
|
||||
const char *lUserName = linphone_address_get_username(addr);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue