Commit 4464acea authored by atraczyk's avatar atraczyk Committed by Andreas Traczyk

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
parent 38f15644
...@@ -200,10 +200,8 @@ RingClientUWP::RingD::startDaemon() ...@@ -200,10 +200,8 @@ RingClientUWP::RingD::startDaemon()
else { else {
if (!hasConfig) if (!hasConfig)
{ {
std::map<std::string, std::string> ringAccountDetails; tasksList_.push(ref new RingD::Task(Request::AddRingAccount));
ringAccountDetails.insert(std::make_pair(ring::Conf::CONFIG_ACCOUNT_ALIAS, accountName)); tasksList_.push(ref new RingD::Task(Request::AddSIPAccount));
ringAccountDetails.insert(std::make_pair(ring::Conf::CONFIG_ACCOUNT_TYPE,"RING"));
DRing::addAccount(ringAccountDetails);
} }
else { else {
CoreApplication::MainView->CoreWindow->Dispatcher->RunAsync(CoreDispatcherPriority::Normal, CoreApplication::MainView->CoreWindow->Dispatcher->RunAsync(CoreDispatcherPriority::Normal,
...@@ -233,6 +231,23 @@ RingD::dequeueTasks() ...@@ -233,6 +231,23 @@ RingD::dequeueTasks()
auto task = tasksList_.front(); auto task = tasksList_.front();
switch (task->request) { switch (task->request) {
case Request::None: 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: default:
break; break;
} }
......
...@@ -68,9 +68,15 @@ internal: ...@@ -68,9 +68,15 @@ internal:
private: private:
/* sub classes */ /* sub classes */
enum class Request { None }; enum class Request {
None,
AddRingAccount,
AddSIPAccount
};
ref class Task ref class Task
{ {
internal:
Task(Request r) { request = r; }
public: public:
property Request request; property Request request;
}; };
......
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