Commit d57809fd authored by Nicolas Jager's avatar Nicolas Jager
Browse files

fix : incomming sip message

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