From f494bdada4906ac065a2ad6df0ce62742f210a85 Mon Sep 17 00:00:00 2001 From: Nicolas Jager <nicolas.jager@savoirfairelinux.com> Date: Fri, 16 Sep 2016 08:43:43 -0400 Subject: [PATCH] contact ring id : fix bad formatting - trimms the the string "from" received by the daemon's IncomingCall signal Change-Id: I0dd6afcfcd43847afbda640b387465d12a9930d8 --- RingD.cpp | 3 +++ Utils.h | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/RingD.cpp b/RingD.cpp index d2a2929..ccd7f00 100644 --- a/RingD.cpp +++ b/RingD.cpp @@ -194,6 +194,9 @@ RingClientUWP::RingD::startDaemon() auto callId2 = toPlatformString(callId); auto from2 = toPlatformString(from); + /* fix some issue in the daemon --> <...@...> */ + from2 = Utils::TrimRingId(from2); + CoreApplication::MainView->CoreWindow->Dispatcher->RunAsync( CoreDispatcherPriority::Normal, ref new DispatchedHandler([=]() { diff --git a/Utils.h b/Utils.h index 9eb3f0b..0a61889 100644 --- a/Utils.h +++ b/Utils.h @@ -106,6 +106,24 @@ Platform::String^ Trim(Platform::String^ s) return ref new Platform::String(first, static_cast<unsigned int>(last - first)); } +/* fix some issue in the daemon --> <...@...> */ +Platform::String^ TrimRingId(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() { GUID result; -- GitLab