Commit eadf80d9 authored by Benjamin REIS's avatar Benjamin REIS

Clearer code

parent d9228582
......@@ -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;
......
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