Commit d57809fd authored by Nicolas Jager's avatar Nicolas Jager

fix : incomming sip message

Change-Id: Ifc5bfb1c076816767c350a34d88d5efc102e3122
Tuleap: #1210
parent 8f805cd5
......@@ -170,9 +170,12 @@ ContactsViewModel::Destringify(String^ data)
}
void RingClientUWP::ViewModel::ContactsViewModel::OnincomingMessage(Platform::String ^callId, Platform::String ^from, Platform::String ^payload)
void RingClientUWP::ViewModel::ContactsViewModel::OnincomingMessage(Platform::String ^callId, Platform::String ^payload)
{
auto contact = findContactByName(from);
auto item = SmartPanelItemsViewModel::instance->findItem(callId);
auto contact = item->_contact;
/* the contact HAS TO BE already registered */
if (contact) {
......@@ -185,7 +188,7 @@ void RingClientUWP::ViewModel::ContactsViewModel::OnincomingMessage(Platform::St
auto selectedContact = (item) ? item->_contact : nullptr;
if (contact->ringID_ == from && contact != selectedContact) {
if (contact != selectedContact) {
contact->_unreadMessages++;
/* saveContactsToFile used to save the notification */
saveContactsToFile();
......
......@@ -68,7 +68,7 @@ private:
Contact^ currentItem_;
Contact^ oldItem_;
void OnincomingMessage(Platform::String ^callId, Platform::String ^from, Platform::String ^payload);
void OnincomingMessage(Platform::String ^callId, Platform::String ^payload);
};
}
}
......@@ -139,7 +139,7 @@ RingClientUWP::Views::BubbleHorizontalAlignement::BubbleHorizontalAlignement()
{}
void RingClientUWP::Views::MessageTextPage::OnincomingMessage(Platform::String ^callId, Platform::String ^from, Platform::String ^payload)
void RingClientUWP::Views::MessageTextPage::OnincomingMessage(Platform::String ^callId, Platform::String ^payload)
{
scrollDown();
}
......@@ -49,7 +49,7 @@ private:
void _sendBtn__Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
void _messageTextBox__KeyDown(Platform::Object^ sender, Windows::UI::Xaml::Input::KeyRoutedEventArgs^ e);
void sendMessage();
void OnincomingMessage(Platform::String ^callId, Platform::String ^from, Platform::String ^payload);
void OnincomingMessage(Platform::String ^callId, Platform::String ^payload);
};
}
}
......@@ -296,7 +296,7 @@ RingClientUWP::RingD::startDaemon()
auto callId2 = toPlatformString(callId);
auto from2 = toPlatformString(from);
from2 = Utils::TrimRingId2(from2);
///from2 = Utils::TrimFrom(from2);
const std::string PROFILE_VCF = "x-ring/ring.profile.vcard";
......@@ -314,7 +314,7 @@ RingClientUWP::RingD::startDaemon()
CoreApplication::MainView->CoreWindow->Dispatcher->RunAsync(
CoreDispatcherPriority::High, ref new DispatchedHandler([=]()
{
incomingMessage(callId2, from2, payload);
incomingMessage(callId2, payload);
MSG_("message recu :" + i.second);
}));
}
......
......@@ -31,7 +31,7 @@ delegate void IncomingCall(String^ accountId, String^ callId, String^ from);
delegate void StateChange(String^ callId, CallStatus state, int code);
delegate void IncomingAccountMessage(String^ accountId, String^ from, String^ payload);
delegate void CallPlaced(String^ callId);
delegate void IncomingMessage(String^ callId, String^ from, String^ payload);
delegate void IncomingMessage(String^ callId, String^ payload);
public ref class RingD sealed
......
......@@ -135,6 +135,7 @@ TrimRingId(Platform::String^ s)
/* fix some issue in the daemon --> remove "@..." */
Platform::String^
TrimRingId2(Platform::String^ s)
{
const WCHAR* first = s->Begin();
......@@ -148,6 +149,24 @@ TrimRingId2(Platform::String^ s)
return ref new Platform::String(first, static_cast<unsigned int>(last - first));
}
Platform::String^
TrimFrom(Platform::String^ s)
{
const WCHAR* first = s->Begin();
const WCHAR* last = s->End();
while (first != last && *first != ':')
++first;
while (first != last && last[-1] != '>')
--last;
first++;
last--;
return ref new Platform::String(first, static_cast<unsigned int>(last - first));
}
Platform::String^
GetNewGUID()
{
......@@ -167,7 +186,7 @@ getStringFromFile(const std::string& filename)
{
std::ifstream file(filename);
return std::string((std::istreambuf_iterator<char>(file)),
(std::istreambuf_iterator<char>()));
(std::istreambuf_iterator<char>()));
}
inline Map<String^,String^>^
......
......@@ -332,7 +332,7 @@ VideoPage::WriteFrameAsSoftwareBitmapAsync(String^ id, uint8_t* buf, int width,
}
void RingClientUWP::Views::VideoPage::OnincomingMessage(Platform::String ^callId, Platform::String ^from, Platform::String ^payload)
void RingClientUWP::Views::VideoPage::OnincomingMessage(Platform::String ^callId, Platform::String ^payload)
{
scrollDown();
}
......@@ -115,7 +115,7 @@ private:
void _videoControl__PointerMoved(Platform::Object^ sender, Windows::UI::Xaml::Input::PointerRoutedEventArgs^ e);
void btnAny_entered(Platform::Object^ sender, Windows::UI::Xaml::Input::PointerRoutedEventArgs^ e);
void btnAny_exited(Platform::Object^ sender, Windows::UI::Xaml::Input::PointerRoutedEventArgs^ e);
void OnincomingMessage(Platform::String ^callId, Platform::String ^from, Platform::String ^payload);
void OnincomingMessage(Platform::String ^callId, Platform::String ^payload);
};
}
}
\ No newline at end of file
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