From 4464acea4c382c83e86c6f092fc248e139854539 Mon Sep 17 00:00:00 2001 From: atraczyk <andreastraczyk@gmail.com> Date: Thu, 1 Sep 2016 09:37:37 -0400 Subject: [PATCH] ringd: adds account adding as a task handler request option - adds AddRingAccount and AddSIPAccount as task request options so accounts can be created from outside ringd's thread Change-Id: Idcdd54ce5533779a49338e34515381a300782163 Tuleap: #986 --- RingD.cpp | 23 +++++++++++++++++++---- RingD.h | 8 +++++++- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/RingD.cpp b/RingD.cpp index c69845c..00eccbb 100644 --- a/RingD.cpp +++ b/RingD.cpp @@ -200,10 +200,8 @@ RingClientUWP::RingD::startDaemon() else { if (!hasConfig) { - std::map<std::string, std::string> ringAccountDetails; - ringAccountDetails.insert(std::make_pair(ring::Conf::CONFIG_ACCOUNT_ALIAS, accountName)); - ringAccountDetails.insert(std::make_pair(ring::Conf::CONFIG_ACCOUNT_TYPE,"RING")); - DRing::addAccount(ringAccountDetails); + tasksList_.push(ref new RingD::Task(Request::AddRingAccount)); + tasksList_.push(ref new RingD::Task(Request::AddSIPAccount)); } else { CoreApplication::MainView->CoreWindow->Dispatcher->RunAsync(CoreDispatcherPriority::Normal, @@ -233,6 +231,23 @@ RingD::dequeueTasks() auto task = tasksList_.front(); switch (task->request) { case Request::None: + break; + case Request::AddRingAccount: + { + std::map<std::string, std::string> ringAccountDetails; + ringAccountDetails.insert(std::make_pair(ring::Conf::CONFIG_ACCOUNT_ALIAS, accountName)); + ringAccountDetails.insert(std::make_pair(ring::Conf::CONFIG_ACCOUNT_TYPE,"RING")); + DRing::addAccount(ringAccountDetails); + } + break; + case Request::AddSIPAccount: + { + std::map<std::string, std::string> sipAccountDetails; + sipAccountDetails.insert(std::make_pair(ring::Conf::CONFIG_ACCOUNT_ALIAS, accountName + " (SIP)")); + sipAccountDetails.insert(std::make_pair(ring::Conf::CONFIG_ACCOUNT_TYPE,"SIP")); + DRing::addAccount(sipAccountDetails); + } + break; default: break; } diff --git a/RingD.h b/RingD.h index 366ea2e..5aaaa30 100644 --- a/RingD.h +++ b/RingD.h @@ -68,9 +68,15 @@ internal: private: /* sub classes */ - enum class Request { None }; + enum class Request { + None, + AddRingAccount, + AddSIPAccount + }; ref class Task { + internal: + Task(Request r) { request = r; } public: property Request request; }; -- GitLab