set correct SIP address in chatroom when phone number linked

This commit is contained in:
Benjamin Reis 2017-02-15 11:12:58 +01:00
parent eca35807b2
commit 0b48ad284b

View file

@ -84,8 +84,14 @@
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[tableView deselectRowAtIndexPath:indexPath animated:YES];
LinphoneChatRoom *room = linphone_core_get_chat_room_from_uri(
LC, ((NSString *)[_contacts.allKeys objectAtIndex:indexPath.row]).UTF8String);
NSString *uri;
LinphoneAddress *addr = [LinphoneUtils normalizeSipOrPhoneAddress:[_contacts.allKeys objectAtIndex:indexPath.row]];
if (addr) {
uri = [NSString stringWithUTF8String:linphone_address_as_string(addr)];
} else {
uri = [_contacts.allKeys objectAtIndex:indexPath.row];
}
LinphoneChatRoom *room = linphone_core_get_chat_room_from_uri(LC, uri.UTF8String);
if (!room) {
[PhoneMainView.instance popCurrentView];
UIAlertController *errView = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"Invalid address", nil)