From 10f8b117f9f4196b8d536a4c0f5ff9af79c96041 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 27 Feb 2013 13:26:22 +0100 Subject: [PATCH] Handle chat initiation to an email address. --- Classes/ChatRoomViewController.m | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Classes/ChatRoomViewController.m b/Classes/ChatRoomViewController.m index b096f4acd..617856b3a 100644 --- a/Classes/ChatRoomViewController.m +++ b/Classes/ChatRoomViewController.m @@ -238,7 +238,19 @@ static UICompositeViewDescription *compositeDescription = nil; if(remoteAddress != nil) { [remoteAddress release]; } - remoteAddress = [aRemoteAddress copy]; + if ([aRemoteAddress hasPrefix:@"sip:"]) { + remoteAddress = [aRemoteAddress copy]; + } else { + char normalizedUserName[256]; + LinphoneCore *lc = [LinphoneManager getLc]; + LinphoneProxyConfig* proxyCfg; + linphone_core_get_default_proxy(lc,&proxyCfg); + LinphoneAddress* linphoneAddress = linphone_address_new(linphone_core_get_identity(lc)); + linphone_proxy_config_normalize_number(proxyCfg, [aRemoteAddress cStringUsingEncoding:[NSString defaultCStringEncoding]], normalizedUserName, sizeof(normalizedUserName)); + linphone_address_set_username(linphoneAddress, normalizedUserName); + remoteAddress = [[NSString stringWithUTF8String:linphone_address_as_string_uri_only(linphoneAddress)] copy]; + linphone_address_destroy(linphoneAddress); + } [messageField setText:@""]; [self update]; [tableController setRemoteAddress: remoteAddress];