mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-05-07 05:53:06 +00:00
fix crash when no proxy config
This commit is contained in:
parent
ef08adee42
commit
57662b35ed
6 changed files with 43 additions and 22 deletions
|
|
@ -96,10 +96,12 @@
|
|||
}
|
||||
|
||||
LinphoneProxyConfig *cfg = linphone_core_get_default_proxy_config(LC);
|
||||
const char *normalizedPhoneNumber = linphone_proxy_config_normalize_phone_number(cfg, phoneNumber);
|
||||
addr = linphone_proxy_config_normalize_sip_uri(cfg, normalizedPhoneNumber);
|
||||
uri = linphone_address_as_string_uri_only(addr);
|
||||
address = [NSString stringWithUTF8String:uri];
|
||||
if (cfg) {
|
||||
const char *normalizedPhoneNumber = linphone_proxy_config_normalize_phone_number(cfg, phoneNumber);
|
||||
addr = linphone_proxy_config_normalize_sip_uri(cfg, normalizedPhoneNumber);
|
||||
uri = linphone_address_as_string_uri_only(addr);
|
||||
address = [NSString stringWithUTF8String:uri];
|
||||
}
|
||||
}
|
||||
|
||||
if (!addr) {
|
||||
|
|
@ -166,8 +168,9 @@
|
|||
UIChatCreateCell *cell = [tableView cellForRowAtIndexPath:indexPath];
|
||||
if (!cell.userInteractionEnabled)
|
||||
return;
|
||||
|
||||
if (!linphone_proxy_config_get_conference_factory_uri(linphone_core_get_default_proxy_config(LC)) || !_isGroupChat) {
|
||||
|
||||
LinphoneProxyConfig *cfg = linphone_core_get_default_proxy_config(LC);
|
||||
if (!(cfg && linphone_proxy_config_get_conference_factory_uri(cfg)) || !_isGroupChat) {
|
||||
LinphoneAddress *addr = linphone_address_new(cell.addressLabel.text.UTF8String);
|
||||
[PhoneMainView.instance getOrCreateOneToOneChatRoom:addr waitView:_waitView isEncrypted:_isEncrypted];
|
||||
if (!addr) {
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ static int sorted_history_comparison(LinphoneChatRoom *to_insert, LinphoneChatRo
|
|||
NSString *display;
|
||||
[dict setObject:[NSString stringWithUTF8String:linphone_address_as_string_uri_only(peer_address)]
|
||||
forKey:@"peer"];
|
||||
[dict setObject:[NSString stringWithUTF8String:linphone_address_as_string_uri_only(local_address)]
|
||||
[dict setObject:local_address?[NSString stringWithUTF8String:linphone_address_as_string_uri_only(local_address)]:@""
|
||||
forKey:@"local"];
|
||||
LinphoneChatRoomCapabilitiesMask capabilities = linphone_chat_room_get_capabilities(cr);
|
||||
if (!(capabilities & LinphoneChatRoomCapabilitiesOneToOne)) {
|
||||
|
|
|
|||
|
|
@ -1144,7 +1144,7 @@ static void linphone_iphone_popup_password_request(LinphoneCore *lc, LinphoneAut
|
|||
ms_free(peer_address);
|
||||
|
||||
const LinphoneAddress *localAddress = linphone_chat_room_get_local_address(room);
|
||||
char *local_address = linphone_address_as_string_uri_only(localAddress);
|
||||
char *local_address = localAddress? linphone_address_as_string_uri_only(localAddress) : "";
|
||||
NSString *local_uri = [NSString stringWithUTF8String:local_address];
|
||||
ms_free(local_address);
|
||||
|
||||
|
|
|
|||
|
|
@ -45,8 +45,9 @@
|
|||
- (void)setAddress:(NSString *)address {
|
||||
_addressLabel.text = _editTextfield.text = address;
|
||||
char *normAddr = (char *)_addressLabel.text.UTF8String;
|
||||
if(_addressLabel.text && linphone_proxy_config_is_phone_number(linphone_core_get_default_proxy_config(LC), _addressLabel.text.UTF8String)) {
|
||||
normAddr = linphone_proxy_config_normalize_phone_number(linphone_core_get_default_proxy_config(LC),
|
||||
LinphoneProxyConfig *cfg = linphone_core_create_proxy_config(LC);
|
||||
if(_addressLabel.text && cfg && linphone_proxy_config_is_phone_number(cfg, _addressLabel.text.UTF8String)) {
|
||||
normAddr = linphone_proxy_config_normalize_phone_number(cfg,
|
||||
_addressLabel.text.UTF8String);
|
||||
}
|
||||
LinphoneAddress *addr = linphone_core_interpret_url(LC, normAddr);
|
||||
|
|
@ -65,12 +66,11 @@
|
|||
|
||||
self.linphoneImage.hidden =
|
||||
!((model && linphone_presence_model_get_basic_status(model) == LinphonePresenceBasicStatusOpen) ||
|
||||
(!linphone_proxy_config_is_phone_number(linphone_core_get_default_proxy_config(LC),
|
||||
(cfg && !linphone_proxy_config_is_phone_number(cfg,
|
||||
_addressLabel.text.UTF8String) &&
|
||||
[FastAddressBook isSipURIValid:_addressLabel.text]));
|
||||
ContactDetailsView *contactDetailsView = VIEW(ContactDetailsView);
|
||||
self.inviteButton.hidden = !ENABLE_SMS_INVITE || [[contactDetailsView.contact sipAddresses] count] > 0 || !self.linphoneImage.hidden;
|
||||
LinphoneProxyConfig *cfg = linphone_core_get_default_proxy_config(LC);
|
||||
[self shouldHideEncryptedChatView:cfg && linphone_proxy_config_get_conference_factory_uri(cfg) && model && linphone_presence_model_has_capability(model, LinphoneFriendCapabilityLimeX3dh)];
|
||||
}
|
||||
|
||||
|
|
@ -97,9 +97,10 @@
|
|||
}
|
||||
|
||||
char *normAddr = (char *)_addressLabel.text.UTF8String;
|
||||
if (linphone_proxy_config_is_phone_number(linphone_core_get_default_proxy_config(LC),
|
||||
LinphoneProxyConfig *cfg = linphone_core_get_default_proxy_config(LC);
|
||||
if (cfg && linphone_proxy_config_is_phone_number(cfg,
|
||||
_addressLabel.text.UTF8String)) {
|
||||
normAddr = linphone_proxy_config_normalize_phone_number(linphone_core_get_default_proxy_config(LC),
|
||||
normAddr = linphone_proxy_config_normalize_phone_number(cfg,
|
||||
_addressLabel.text.UTF8String);
|
||||
}
|
||||
LinphoneAddress *addr = linphone_core_interpret_url(LC, normAddr);
|
||||
|
|
@ -108,7 +109,7 @@
|
|||
Contact *contact = [FastAddressBook getContactWithAddress:(addr)];
|
||||
|
||||
if (contact) {
|
||||
self.linphoneImage.hidden = ! ((contact.friend && linphone_presence_model_get_basic_status(linphone_friend_get_presence_model_for_uri_or_tel(contact.friend, _addressLabel.text.UTF8String)) == LinphonePresenceBasicStatusOpen) || (!linphone_proxy_config_is_phone_number(linphone_core_get_default_proxy_config(LC), _addressLabel.text.UTF8String) && [FastAddressBook isSipURIValid:_addressLabel.text]));
|
||||
self.linphoneImage.hidden = ! ((contact.friend && linphone_presence_model_get_basic_status(linphone_friend_get_presence_model_for_uri_or_tel(contact.friend, _addressLabel.text.UTF8String)) == LinphonePresenceBasicStatusOpen) || (cfg && !linphone_proxy_config_is_phone_number(cfg, _addressLabel.text.UTF8String) && [FastAddressBook isSipURIValid:_addressLabel.text]));
|
||||
}
|
||||
|
||||
if (addr) {
|
||||
|
|
|
|||
|
|
@ -873,8 +873,16 @@ static RootViewManager *rootViewManagerInstance = nil;
|
|||
return;
|
||||
}
|
||||
|
||||
const LinphoneAddress *local = linphone_proxy_config_get_contact(linphone_core_get_default_proxy_config(LC));
|
||||
LinphoneAddress *local;
|
||||
LinphoneProxyConfig *cfg = linphone_core_get_default_proxy_config(LC);
|
||||
if (cfg) {
|
||||
local = linphone_address_clone(linphone_proxy_config_get_contact(cfg));
|
||||
} else {
|
||||
local = linphone_core_create_primary_contact_parsed(LC);
|
||||
}
|
||||
LinphoneChatRoom *room = linphone_core_find_one_to_one_chat_room_2(LC, local, remoteAddress, isEncrypted);
|
||||
linphone_address_unref(local);
|
||||
|
||||
if (!room) {
|
||||
bctbx_list_t *addresses = bctbx_list_new((void*)remoteAddress);
|
||||
[self createChatRoom:LINPHONE_DUMMY_SUBJECT addresses:addresses andWaitView:waitView isEncrypted:isEncrypted isGroup:FALSE];
|
||||
|
|
@ -886,7 +894,8 @@ static RootViewManager *rootViewManagerInstance = nil;
|
|||
}
|
||||
|
||||
- (LinphoneChatRoom *)createChatRoom:(const char *)subject addresses:(bctbx_list_t *)addresses andWaitView:(UIView *)waitView isEncrypted:(BOOL)isEncrypted isGroup:(BOOL)isGroup{
|
||||
if (!linphone_proxy_config_get_conference_factory_uri(linphone_core_get_default_proxy_config(LC))
|
||||
LinphoneProxyConfig *cfg = linphone_core_get_default_proxy_config(LC);
|
||||
if (!(cfg && linphone_proxy_config_get_conference_factory_uri(cfg))
|
||||
|| ((bctbx_list_size(addresses) == 1) && !isGroup && ([[LinphoneManager instance] lpConfigBoolForKey:@"prefer_basic_chat_room" inSection:@"misc"] || !isEncrypted))) {
|
||||
// If there's no factory uri, create a basic chat room
|
||||
if (bctbx_list_size(addresses) != 1) {
|
||||
|
|
|
|||
|
|
@ -85,10 +85,16 @@
|
|||
while (numbers) {
|
||||
NSString *phone = [NSString stringWithUTF8String:numbers->data];
|
||||
LinphoneProxyConfig *cfg = linphone_core_get_default_proxy_config(LC);
|
||||
const char *normvalue = linphone_proxy_config_normalize_phone_number(cfg, phone.UTF8String);
|
||||
LinphoneAddress *addr = linphone_proxy_config_normalize_sip_uri(cfg, normvalue);
|
||||
const char *phone_addr = linphone_address_as_string_uri_only(addr);
|
||||
contact = [FastAddressBook getContact:[NSString stringWithUTF8String:phone_addr]];
|
||||
|
||||
if (cfg) {
|
||||
const char *normvalue = linphone_proxy_config_normalize_phone_number(cfg, phone.UTF8String);
|
||||
LinphoneAddress *addr = linphone_proxy_config_normalize_sip_uri(cfg, normvalue);
|
||||
const char *phone_addr = linphone_address_as_string_uri_only(addr);
|
||||
contact = [FastAddressBook getContact:[NSString stringWithUTF8String:phone_addr]];
|
||||
} else {
|
||||
contact = [FastAddressBook getContact:phone];
|
||||
}
|
||||
|
||||
if (contact) {
|
||||
break;
|
||||
}
|
||||
|
|
@ -226,9 +232,11 @@
|
|||
Contact* mContact = contact;
|
||||
if (!_addressBookMap)
|
||||
return;
|
||||
|
||||
LinphoneProxyConfig *cfg = linphone_core_create_proxy_config(LC);
|
||||
|
||||
for (NSString *phone in mContact.phones) {
|
||||
char *normalizedPhone = linphone_proxy_config_normalize_phone_number(linphone_core_get_default_proxy_config(LC), phone.UTF8String);
|
||||
char *normalizedPhone = cfg? linphone_proxy_config_normalize_phone_number(linphone_core_get_default_proxy_config(LC), phone.UTF8String) : nil;
|
||||
NSString *name = [FastAddressBook normalizeSipURI:normalizedPhone ? [NSString stringWithUTF8String:normalizedPhone] : phone];
|
||||
if (phone != NULL)
|
||||
[_addressBookMap setObject:mContact forKey:(name ?: [FastAddressBook localizedLabel:phone])];
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue