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()
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;
}
......
......@@ -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;
};
......
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