mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 11:08:06 +00:00
Clearer code
This commit is contained in:
parent
d922858254
commit
eadf80d9d9
1 changed files with 24 additions and 23 deletions
|
|
@ -210,39 +210,40 @@
|
|||
}
|
||||
|
||||
- (void)registerAddrsFor:(Contact *)contact {
|
||||
if (!contact)
|
||||
return;
|
||||
|
||||
Contact* mContact = contact;
|
||||
for (NSString *phone in mContact.phones) {
|
||||
char *normalizedPhone = linphone_proxy_config_normalize_phone_number(linphone_core_get_default_proxy_config(LC), phone.UTF8String);
|
||||
NSString *name = [FastAddressBook normalizeSipURI:normalizedPhone ? [NSString stringWithUTF8String:normalizedPhone] : phone];
|
||||
if (phone != NULL) {
|
||||
if(_addressBookMap){
|
||||
if(mContact){
|
||||
[_addressBookMap setObject:mContact forKey:(name ?: [FastAddressBook localizedLabel:phone])];
|
||||
}else{
|
||||
// Dosomte
|
||||
}
|
||||
}
|
||||
}
|
||||
if (normalizedPhone)
|
||||
ms_free(normalizedPhone);
|
||||
}
|
||||
for (NSString *sip in mContact.sipAddresses) {
|
||||
[_addressBookMap setObject:mContact forKey:([FastAddressBook normalizeSipURI:sip] ?: sip)];
|
||||
}
|
||||
if (!_addressBookMap)
|
||||
return;
|
||||
|
||||
for (NSString *phone in mContact.phones) {
|
||||
char *normalizedPhone = linphone_proxy_config_normalize_phone_number(linphone_core_get_default_proxy_config(LC), phone.UTF8String);
|
||||
NSString *name = [FastAddressBook normalizeSipURI:normalizedPhone ? [NSString stringWithUTF8String:normalizedPhone] : phone];
|
||||
if (phone != NULL)
|
||||
[_addressBookMap setObject:mContact forKey:(name ?: [FastAddressBook localizedLabel:phone])];
|
||||
|
||||
if (normalizedPhone)
|
||||
ms_free(normalizedPhone);
|
||||
}
|
||||
|
||||
for (NSString *sip in mContact.sipAddresses)
|
||||
[_addressBookMap setObject:mContact forKey:([FastAddressBook normalizeSipURI:sip] ?: sip)];
|
||||
}
|
||||
|
||||
#pragma mark - Tools
|
||||
|
||||
+ (NSString *)localizedLabel:(NSString *)label {
|
||||
if (label != nil) {
|
||||
return [CNLabeledValue localizedStringForLabel:label];
|
||||
}
|
||||
return @"";
|
||||
if (label)
|
||||
return [CNLabeledValue localizedStringForLabel:label];
|
||||
|
||||
return @"";
|
||||
}
|
||||
|
||||
+ (BOOL)contactHasValidSipDomain:(Contact *)contact {
|
||||
if (contact == nil)
|
||||
if (!contact)
|
||||
return NO;
|
||||
|
||||
// Check if one of the contact' sip URI matches the expected SIP filter
|
||||
NSString *domain = LinphoneManager.instance.contactFilter;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue