Commit e80aa34f authored by Ghislain MARY's avatar Ghislain MARY

Use properties in LinphoneAddress object.

parent 3328dc2c
#include "LinphoneAddress.h" #include "LinphoneAddress.h"
#include "Server.h" #include "Server.h"
Platform::String^ Linphone::Core::LinphoneAddress::GetDisplayName() Platform::String^ Linphone::Core::LinphoneAddress::DisplayName::get()
{ {
return Linphone::Core::Utils::cctops(linphone_address_get_display_name(this->address)); return Linphone::Core::Utils::cctops(linphone_address_get_display_name(this->address));
} }
Platform::String^ Linphone::Core::LinphoneAddress::GetUserName() Platform::String^ Linphone::Core::LinphoneAddress::UserName::get()
{ {
return Linphone::Core::Utils::cctops(linphone_address_get_username(this->address)); return Linphone::Core::Utils::cctops(linphone_address_get_username(this->address));
} }
Platform::String^ Linphone::Core::LinphoneAddress::GetDomain() Platform::String^ Linphone::Core::LinphoneAddress::Domain::get()
{ {
return Linphone::Core::Utils::cctops(linphone_address_get_domain(this->address)); return Linphone::Core::Utils::cctops(linphone_address_get_domain(this->address));
} }
int Linphone::Core::LinphoneAddress::GetPort() int Linphone::Core::LinphoneAddress::Port::get()
{ {
return linphone_address_get_port(this->address); return linphone_address_get_port(this->address);
} }
Linphone::Core::LinphoneTransport Linphone::Core::LinphoneAddress::GetTransport() Linphone::Core::LinphoneTransport Linphone::Core::LinphoneAddress::Transport::get()
{ {
LinphoneTransportType transport = linphone_address_get_transport(this->address); LinphoneTransportType transport = linphone_address_get_transport(this->address);
switch (transport) switch (transport)
...@@ -39,33 +39,38 @@ Linphone::Core::LinphoneTransport Linphone::Core::LinphoneAddress::GetTransport( ...@@ -39,33 +39,38 @@ Linphone::Core::LinphoneTransport Linphone::Core::LinphoneAddress::GetTransport(
} }
} }
void Linphone::Core::LinphoneAddress::SetDisplayName(Platform::String^ name) Platform::String^ Linphone::Core::LinphoneAddress::Scheme::get()
{
return Linphone::Core::Utils::cctops(linphone_address_get_scheme(this->address));
}
void Linphone::Core::LinphoneAddress::DisplayName::set(Platform::String^ name)
{ {
const char *cc = Linphone::Core::Utils::pstoccs(name); const char *cc = Linphone::Core::Utils::pstoccs(name);
linphone_address_set_display_name(this->address, cc); linphone_address_set_display_name(this->address, cc);
delete(cc); delete(cc);
} }
void Linphone::Core::LinphoneAddress::SetUserName(Platform::String^ username) void Linphone::Core::LinphoneAddress::UserName::set(Platform::String^ username)
{ {
const char *cc = Linphone::Core::Utils::pstoccs(username); const char *cc = Linphone::Core::Utils::pstoccs(username);
linphone_address_set_username(this->address, cc); linphone_address_set_username(this->address, cc);
delete(cc); delete(cc);
} }
void Linphone::Core::LinphoneAddress::SetDomain(Platform::String^ domain) void Linphone::Core::LinphoneAddress::Domain::set(Platform::String^ domain)
{ {
const char *cc = Linphone::Core::Utils::pstoccs(domain); const char *cc = Linphone::Core::Utils::pstoccs(domain);
linphone_address_set_domain(this->address, cc); linphone_address_set_domain(this->address, cc);
delete(cc); delete(cc);
} }
void Linphone::Core::LinphoneAddress::SetPort(int port) void Linphone::Core::LinphoneAddress::Port::set(int port)
{ {
linphone_address_set_port(this->address, port); linphone_address_set_port(this->address, port);
} }
void Linphone::Core::LinphoneAddress::SetTransport(Linphone::Core::LinphoneTransport transport) void Linphone::Core::LinphoneAddress::Transport::set(Linphone::Core::LinphoneTransport transport)
{ {
LinphoneTransportType transportType = LinphoneTransportUdp; LinphoneTransportType transportType = LinphoneTransportUdp;
if (transport == LinphoneTransport::LinphoneTransportTCP) if (transport == LinphoneTransport::LinphoneTransportTCP)
......
...@@ -29,68 +29,64 @@ namespace Linphone ...@@ -29,68 +29,64 @@ namespace Linphone
{ {
public: public:
/// <summary> /// <summary>
/// Gets the human display name of the address. /// The human display name of the address.
/// For example for the "Alice &lt;sip:alice@example.net&gt;" URI, it will return "Alice". /// For example for the "Alice &lt;sip:alice@example.net&gt;" URI, it will return "Alice".
/// </summary> /// </summary>
/// <returns>The human display name or an empty string if not set</returns> property Platform::String^ DisplayName
Platform::String^ GetDisplayName(); {
Platform::String^ get();
void set(Platform::String^ value);
}
/// <summary> /// <summary>
/// Gets the username part of the address. /// The username part of the address.
/// For example for the "Alice &lt;sip:alice@example.net&gt;" URI, it will return "alice". /// For example for the "Alice &lt;sip:alice@example.net&gt;" URI, it will return "alice".
/// </summary> /// </summary>
/// <returns>The username part of the address or an empty string if not set</returns> property Platform::String^ UserName
Platform::String^ GetUserName(); {
Platform::String^ get();
void set(Platform::String^ value);
}
/// <summary> /// <summary>
/// Gets the domain part of the address. /// The domain part of the address.
/// For example for the "Alice &lt;sip:alice@example.net&gt;" URI, it will return "example.net". /// For example for the "Alice &lt;sip:alice@example.net&gt;" URI, it will return "example.net".
/// </summary> /// </summary>
/// <returns>The domain part of the address or an empty string if not set</returns> property Platform::String^ Domain
Platform::String^ GetDomain(); {
Platform::String^ get();
void set(Platform::String^ value);
}
/// <summary> /// <summary>
/// Gets the port part of the address. /// The port part of the address.
/// </summary> /// </summary>
/// <returns>The port part of the address or 0 if not set</returns> property int Port
int GetPort(); {
int get();
void set(int value);
}
/// <summary> /// <summary>
/// Gets the transport of the address. /// The transport of the address.
/// </summary> /// </summary>
/// <returns>The transport if specified. If not set, it will return UDP.</returns> property LinphoneTransport Transport
LinphoneTransport GetTransport(); {
LinphoneTransport get();
void set(LinphoneTransport value);
}
/// <summary> /// <summary>
/// Sets the human display name of the address. /// The address scheme, normally "sip".
/// </summary> /// </summary>
/// <param name="name">The human display name to set to the address</param> property Platform::String^ Scheme
void SetDisplayName(Platform::String^ name); {
Platform::String^ get();
}
/// <summary> /// <summary>
/// Sets the username part of the address. /// Removes address's tags and uri headers so that it is displayable to the user.
/// </summary> /// </summary>
/// <param name="username">The username to set to the address</param>
void SetUserName(Platform::String^ username);
/// <summary>
/// Sets the domain part of the address.
/// </summary>
/// <param name="domain">The domain to set to the address</param>
void SetDomain(Platform::String^ domain);
/// <summary>
/// Sets the port part of the address.
/// </summary>
/// <param name="port">The port to set to the address</param>
void SetPort(int port);
/// <summary>
/// Sets the transport in the address.
/// </summary>
/// <param name="transport">The transport to set.</param>
void SetTransport(LinphoneTransport transport);
void Clean(); void Clean();
/// <summary> /// <summary>
......
...@@ -1552,10 +1552,10 @@ void call_state_changed(::LinphoneCore *lc, ::LinphoneCall *call, ::LinphoneCall ...@@ -1552,10 +1552,10 @@ void call_state_changed(::LinphoneCore *lc, ::LinphoneCall *call, ::LinphoneCall
Linphone::Core::CallController^ callController = Linphone::Core::Globals::Instance->CallController; Linphone::Core::CallController^ callController = Linphone::Core::Globals::Instance->CallController;
if (state == Linphone::Core::LinphoneCallState::IncomingReceived) { if (state == Linphone::Core::LinphoneCallState::IncomingReceived) {
Platform::String^ name = lCall->GetRemoteAddress()->GetDisplayName(); Platform::String^ name = lCall->GetRemoteAddress()->DisplayName;
if (name == nullptr || name->Length() <= 0) if (name == nullptr || name->Length() <= 0)
{ {
name = lCall->GetRemoteAddress()->GetUserName(); name = lCall->GetRemoteAddress()->UserName;
} }
Windows::Phone::Networking::Voip::VoipPhoneCall^ platformCall = callController->OnIncomingCallReceived(lCall, name, lCall->GetRemoteAddress()->AsStringUriOnly(), callController->IncomingCallViewDismissed); Windows::Phone::Networking::Voip::VoipPhoneCall^ platformCall = callController->OnIncomingCallReceived(lCall, name, lCall->GetRemoteAddress()->AsStringUriOnly(), callController->IncomingCallViewDismissed);
lCall->CallContext = platformCall; lCall->CallContext = platformCall;
...@@ -1583,7 +1583,7 @@ void call_state_changed(::LinphoneCore *lc, ::LinphoneCall *call, ::LinphoneCall ...@@ -1583,7 +1583,7 @@ void call_state_changed(::LinphoneCore *lc, ::LinphoneCall *call, ::LinphoneCall
Windows::Phone::Networking::Voip::VoipPhoneCall^ platformCall = (Windows::Phone::Networking::Voip::VoipPhoneCall^) lCall->CallContext; Windows::Phone::Networking::Voip::VoipPhoneCall^ platformCall = (Windows::Phone::Networking::Voip::VoipPhoneCall^) lCall->CallContext;
if (platformCall == nullptr) { if (platformCall == nullptr) {
// If CallContext is null here, it is because we have an incoming call using the custom incoming call view so create the VoipPhoneCall now // If CallContext is null here, it is because we have an incoming call using the custom incoming call view so create the VoipPhoneCall now
platformCall = callController->NewIncomingCallForCustomIncomingCallView(lCall->GetRemoteAddress()->GetDisplayName()); platformCall = callController->NewIncomingCallForCustomIncomingCallView(lCall->GetRemoteAddress()->DisplayName);
lCall->CallContext = platformCall; lCall->CallContext = platformCall;
} }
if (lCall->IsCameraEnabled()) { if (lCall->IsCameraEnabled()) {
......
...@@ -46,9 +46,9 @@ Linphone::Core::LinphoneAddress^ LinphoneCoreFactory::CreateLinphoneAddress(Plat ...@@ -46,9 +46,9 @@ Linphone::Core::LinphoneAddress^ LinphoneCoreFactory::CreateLinphoneAddress(Plat
{ {
API_LOCK; API_LOCK;
Linphone::Core::LinphoneAddress^ address = CreateLinphoneAddress("sip:user@domain.com"); Linphone::Core::LinphoneAddress^ address = CreateLinphoneAddress("sip:user@domain.com");
address->SetUserName(username); address->UserName = username;
address->SetDomain(domain); address->Domain = domain;
address->SetDisplayName(displayName); address->DisplayName = displayName;
API_UNLOCK; API_UNLOCK;
return address; return address;
} }
......
...@@ -156,8 +156,8 @@ namespace Linphone.Model ...@@ -156,8 +156,8 @@ namespace Linphone.Model
public void FindContact(String numberOrAddress) public void FindContact(String numberOrAddress)
{ {
LinphoneAddress address = LinphoneManager.Instance.LinphoneCore.InterpretURL(numberOrAddress); LinphoneAddress address = LinphoneManager.Instance.LinphoneCore.InterpretURL(numberOrAddress);
string addressWithoutScheme = String.Format("{0}@{1}", address.GetUserName(), address.GetDomain()); string addressWithoutScheme = String.Format("{0}@{1}", address.UserName, address.Domain);
string username = address.GetUserName(); string username = address.UserName;
if (IsPhoneNumber(username)) if (IsPhoneNumber(username))
{ {
FindContactByNumber(username, addressWithoutScheme); FindContactByNumber(username, addressWithoutScheme);
......
...@@ -459,18 +459,18 @@ namespace Linphone.Model ...@@ -459,18 +459,18 @@ namespace Linphone.Model
{ {
foreach (LinphoneCallLog log in LinphoneCore.GetCallLogs()) foreach (LinphoneCallLog log in LinphoneCore.GetCallLogs())
{ {
string from = log.GetFrom().GetDisplayName(); string from = log.GetFrom().DisplayName;
if (from.Length == 0) if (from.Length == 0)
{ {
LinphoneAddress fromAddress = log.GetFrom(); LinphoneAddress fromAddress = log.GetFrom();
from = String.Format("{0}@{1}", fromAddress.GetUserName(), fromAddress.GetDomain()); from = String.Format("{0}@{1}", fromAddress.UserName, fromAddress.Domain);
} }
string to = log.GetTo().GetDisplayName(); string to = log.GetTo().DisplayName;
if (to.Length == 0) if (to.Length == 0)
{ {
LinphoneAddress toAddress = log.GetTo(); LinphoneAddress toAddress = log.GetTo();
to = String.Format("{0}@{1}", toAddress.GetUserName(), toAddress.GetDomain()); to = String.Format("{0}@{1}", toAddress.UserName, toAddress.Domain);
} }
bool isMissed = log.GetStatus() == LinphoneCallStatus.Missed; bool isMissed = log.GetStatus() == LinphoneCallStatus.Missed;
...@@ -868,16 +868,16 @@ namespace Linphone.Model ...@@ -868,16 +868,16 @@ namespace Linphone.Model
if (call.GetDirection() == CallDirection.Outgoing) if (call.GetDirection() == CallDirection.Outgoing)
{ {
text = ResourceManager.GetString("CallErrorDeclined", CultureInfo.CurrentCulture); text = ResourceManager.GetString("CallErrorDeclined", CultureInfo.CurrentCulture);
ShowCallError(text.Replace("#address#", call.GetRemoteAddress().GetUserName())); ShowCallError(text.Replace("#address#", call.GetRemoteAddress().UserName));
} }
break; break;
case Reason.LinphoneReasonNotFound: case Reason.LinphoneReasonNotFound:
text = ResourceManager.GetString("CallErrorNotFound", CultureInfo.CurrentCulture); text = ResourceManager.GetString("CallErrorNotFound", CultureInfo.CurrentCulture);
ShowCallError(text.Replace("#address#", call.GetRemoteAddress().GetUserName())); ShowCallError(text.Replace("#address#", call.GetRemoteAddress().UserName));
break; break;
case Reason.LinphoneReasonBusy: case Reason.LinphoneReasonBusy:
text = ResourceManager.GetString("CallErrorBusy", CultureInfo.CurrentCulture); text = ResourceManager.GetString("CallErrorBusy", CultureInfo.CurrentCulture);
ShowCallError(text.Replace("#address#", call.GetRemoteAddress().GetUserName())); ShowCallError(text.Replace("#address#", call.GetRemoteAddress().UserName));
break; break;
case Reason.LinphoneReasonNotAcceptable: case Reason.LinphoneReasonNotAcceptable:
ShowCallError(ResourceManager.GetString("CallErrorNotAcceptable", CultureInfo.CurrentCulture)); ShowCallError(ResourceManager.GetString("CallErrorNotAcceptable", CultureInfo.CurrentCulture));
...@@ -1044,7 +1044,7 @@ namespace Linphone.Model ...@@ -1044,7 +1044,7 @@ namespace Linphone.Model
BaseModel.UIDispatcher.BeginInvoke(() => BaseModel.UIDispatcher.BeginInvoke(() =>
{ {
LinphoneAddress fromAddress = message.GetFrom(); LinphoneAddress fromAddress = message.GetFrom();
string sipAddress = String.Format("{0}@{1}", fromAddress.GetUserName(), fromAddress.GetDomain()); string sipAddress = String.Format("{0}@{1}", fromAddress.UserName, fromAddress.Domain);
Logger.Msg("[LinphoneManager] Message received from " + sipAddress + ": " + message.GetText() + "\r\n"); Logger.Msg("[LinphoneManager] Message received from " + sipAddress + ": " + message.GetText() + "\r\n");
//Vibrate //Vibrate
...@@ -1123,7 +1123,7 @@ namespace Linphone.Model ...@@ -1123,7 +1123,7 @@ namespace Linphone.Model
{ {
string currentListenerSipAddress = ComposingListener.GetSipAddressAssociatedWithDisplayConversation(); string currentListenerSipAddress = ComposingListener.GetSipAddressAssociatedWithDisplayConversation();
LinphoneAddress peerAddress = room.GetPeerAddress(); LinphoneAddress peerAddress = room.GetPeerAddress();
string roomComposingSipAddress = String.Format("{0}@{1}", peerAddress.GetUserName(), peerAddress.GetDomain()); string roomComposingSipAddress = String.Format("{0}@{1}", peerAddress.UserName, peerAddress.Domain);
if (currentListenerSipAddress != null && roomComposingSipAddress.Equals(currentListenerSipAddress)) if (currentListenerSipAddress != null && roomComposingSipAddress.Equals(currentListenerSipAddress))
ComposingListener.ComposeReceived(); ComposingListener.ComposeReceived();
...@@ -1194,9 +1194,9 @@ namespace Linphone.Model ...@@ -1194,9 +1194,9 @@ namespace Linphone.Model
try try
{ {
LinphoneAddress remoteAddress = call.GetRemoteAddress(); LinphoneAddress remoteAddress = call.GetRemoteAddress();
if (remoteAddress.GetDisplayName().Length == 0) if (remoteAddress.DisplayName.Length == 0)
{ {
string sipAddress = String.Format("{0}@{1}", remoteAddress.GetUserName(), remoteAddress.GetDomain()); string sipAddress = String.Format("{0}@{1}", remoteAddress.UserName, remoteAddress.Domain);
Logger.Msg("[LinphoneManager] Display name null, looking for remote address in contact: " + sipAddress + "\r\n"); Logger.Msg("[LinphoneManager] Display name null, looking for remote address in contact: " + sipAddress + "\r\n");
ContactManager.ContactFound += OnContactFound; ContactManager.ContactFound += OnContactFound;
...@@ -1204,7 +1204,7 @@ namespace Linphone.Model ...@@ -1204,7 +1204,7 @@ namespace Linphone.Model
} }
else else
{ {
Logger.Msg("[LinphoneManager] Display name found: " + call.GetRemoteAddress().GetDisplayName() + "\r\n"); Logger.Msg("[LinphoneManager] Display name found: " + call.GetRemoteAddress().DisplayName + "\r\n");
} }
} }
catch catch
...@@ -1224,7 +1224,7 @@ namespace Linphone.Model ...@@ -1224,7 +1224,7 @@ namespace Linphone.Model
// Store the contact name as display name for call logs // Store the contact name as display name for call logs
if (LinphoneManager.Instance.LinphoneCore.GetCurrentCall() != null) if (LinphoneManager.Instance.LinphoneCore.GetCurrentCall() != null)
{ {
LinphoneManager.Instance.LinphoneCore.GetCurrentCall().GetRemoteAddress().SetDisplayName(e.ContactFound.DisplayName); LinphoneManager.Instance.LinphoneCore.GetCurrentCall().GetRemoteAddress().DisplayName = e.ContactFound.DisplayName;
} }
} }
ContactManager.ContactFound -= OnContactFound; ContactManager.ContactFound -= OnContactFound;
......
...@@ -278,9 +278,9 @@ namespace Linphone.Model ...@@ -278,9 +278,9 @@ namespace Linphone.Model
{ {
LinphoneAddress proxyAddress = LinphoneManager.Instance.LinphoneCoreFactory.CreateLinphoneAddress(cfg.GetAddr()); LinphoneAddress proxyAddress = LinphoneManager.Instance.LinphoneCoreFactory.CreateLinphoneAddress(cfg.GetAddr());
dict[ProxyKeyName] = proxyAddress.AsStringUriOnly(); dict[ProxyKeyName] = proxyAddress.AsStringUriOnly();
dict[TransportKeyName] = EnumToTransport[proxyAddress.GetTransport()]; dict[TransportKeyName] = EnumToTransport[proxyAddress.Transport];
dict[UsernameKeyName] = address.GetUserName(); dict[UsernameKeyName] = address.UserName;
dict[DomainKeyName] = address.GetDomain(); dict[DomainKeyName] = address.Domain;
dict[OutboundProxyKeyName] = (cfg.GetRoute().Length > 0).ToString(); dict[OutboundProxyKeyName] = (cfg.GetRoute().Length > 0).ToString();
var authInfos = LinphoneManager.Instance.LinphoneCore.GetAuthInfos(); var authInfos = LinphoneManager.Instance.LinphoneCore.GetAuthInfos();
if (authInfos.Count > 0) if (authInfos.Count > 0)
...@@ -289,7 +289,7 @@ namespace Linphone.Model ...@@ -289,7 +289,7 @@ namespace Linphone.Model
dict[PasswordKeyName] = info.GetPassword(); dict[PasswordKeyName] = info.GetPassword();
dict[UserIdKeyName] = info.GetUserId(); dict[UserIdKeyName] = info.GetUserId();
} }
dict[DisplayNameKeyName] = address.GetDisplayName(); dict[DisplayNameKeyName] = address.DisplayName;
} }
} }
} }
...@@ -361,7 +361,7 @@ namespace Linphone.Model ...@@ -361,7 +361,7 @@ namespace Linphone.Model
LinphoneAddress proxyAddr = LinphoneManager.Instance.LinphoneCoreFactory.CreateLinphoneAddress(cfg.GetAddr()); LinphoneAddress proxyAddr = LinphoneManager.Instance.LinphoneCoreFactory.CreateLinphoneAddress(cfg.GetAddr());
if (proxyAddr != null) if (proxyAddr != null)
{ {
proxyAddr.SetTransport(TransportToEnum[transport]); proxyAddr.Transport = TransportToEnum[transport];
cfg.SetProxy(proxyAddr.AsStringUriOnly()); cfg.SetProxy(proxyAddr.AsStringUriOnly());
} }
} }
......
...@@ -17,7 +17,7 @@ namespace Linphone.Model ...@@ -17,7 +17,7 @@ namespace Linphone.Model
{ {
string sipAddress = (string)value; string sipAddress = (string)value;
LinphoneAddress addr = LinphoneManager.Instance.LinphoneCore.InterpretURL(sipAddress); LinphoneAddress addr = LinphoneManager.Instance.LinphoneCore.InterpretURL(sipAddress);
return addr.GetUserName(); return addr.UserName;
} }
/// <summary> /// <summary>
......
...@@ -276,8 +276,8 @@ namespace Linphone.Views ...@@ -276,8 +276,8 @@ namespace Linphone.Views
private void CreateChatRoom(LinphoneAddress sipAddress) private void CreateChatRoom(LinphoneAddress sipAddress)
{ {
this.sipAddress = sipAddress; this.sipAddress = sipAddress;
ContactManager.Instance.FindContact(String.Format("{0}@{1}", sipAddress.GetUserName(), sipAddress.GetDomain())); ContactManager.Instance.FindContact(String.Format("{0}@{1}", sipAddress.UserName, sipAddress.Domain));
ContactName.Text = sipAddress.GetUserName(); ContactName.Text = sipAddress.UserName;
ContactName.Visibility = Visibility.Visible; ContactName.Visibility = Visibility.Visible;
NewChat.Visibility = Visibility.Collapsed; NewChat.Visibility = Visibility.Collapsed;
...@@ -503,9 +503,9 @@ namespace Linphone.Views ...@@ -503,9 +503,9 @@ namespace Linphone.Views
Debug.WriteLine("[Chat] Is remote composing ? " + isRemoteComposing); Debug.WriteLine("[Chat] Is remote composing ? " + isRemoteComposing);
RemoteComposing.Visibility = isRemoteComposing ? Visibility.Visible : Visibility.Collapsed; RemoteComposing.Visibility = isRemoteComposing ? Visibility.Visible : Visibility.Collapsed;
string remoteName = chatRoom.GetPeerAddress().GetDisplayName(); string remoteName = chatRoom.GetPeerAddress().DisplayName;
if (remoteName.Length <= 0) if (remoteName.Length <= 0)
remoteName = chatRoom.GetPeerAddress().GetUserName(); remoteName = chatRoom.GetPeerAddress().UserName;
RemoteComposing.Text = remoteName + AppResources.RemoteComposing; RemoteComposing.Text = remoteName + AppResources.RemoteComposing;
} }
...@@ -515,7 +515,7 @@ namespace Linphone.Views ...@@ -515,7 +515,7 @@ namespace Linphone.Views
/// <returns></returns> /// <returns></returns>
public string GetSipAddressAssociatedWithDisplayConversation() public string GetSipAddressAssociatedWithDisplayConversation()
{ {
return String.Format("{0}@{1}", sipAddress.GetUserName(), sipAddress.GetDomain()); return String.Format("{0}@{1}", sipAddress.UserName, sipAddress.Domain);
} }
private void scrollToBottom() private void scrollToBottom()
......
...@@ -117,11 +117,11 @@ namespace Linphone.Views ...@@ -117,11 +117,11 @@ namespace Linphone.Views
if (conversation.GetHistorySize() > 0) if (conversation.GetHistorySize() > 0)
{ {
LinphoneAddress peerAddress = conversation.GetPeerAddress(); LinphoneAddress peerAddress = conversation.GetPeerAddress();
string address = String.Format("{0}@{1}", peerAddress.GetUserName(), peerAddress.GetDomain()); string address = String.Format("{0}@{1}", peerAddress.UserName, peerAddress.Domain);
string name = peerAddress.GetDisplayName(); string name = peerAddress.DisplayName;
if (name == null || name.Length <= 0) if (name == null || name.Length <= 0)
{ {
name = peerAddress.GetUserName(); name = peerAddress.UserName;
} }
_conversations.Add(new Conversation(address, name, conversation.GetHistory())); _conversations.Add(new Conversation(address, name, conversation.GetHistory()));
ContactManager.Instance.FindContact(address); ContactManager.Instance.FindContact(address);
......
...@@ -186,7 +186,7 @@ namespace Linphone.Views ...@@ -186,7 +186,7 @@ namespace Linphone.Views
{ {
String calledNumber = NavigationContext.QueryString["sip"]; String calledNumber = NavigationContext.QueryString["sip"];
LinphoneAddress address = LinphoneManager.Instance.LinphoneCore.InterpretURL(calledNumber); LinphoneAddress address = LinphoneManager.Instance.LinphoneCore.InterpretURL(calledNumber);
calledNumber = String.Format("{0}@{1}", address.GetUserName(), address.GetDomain()); calledNumber = String.Format("{0}@{1}", address.UserName, address.Domain);
// While we dunno if the number matches a contact one, we consider it won't and we display the phone number as username // While we dunno if the number matches a contact one, we consider it won't and we display the phone number as username
Contact.Text = calledNumber; Contact.Text = calledNumber;
......
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