Commit c143aa1d authored by Sébastien Blin's avatar Sébastien Blin
Browse files

accounts: add connectToAccountManager

Change-Id: Ife4f027a7ea4413de09dbde53543af22dc53a847
parent eba15a14
......@@ -150,6 +150,17 @@ public:
*/
bool registerName(const std::string& accountId, const std::string& password, const std::string& username);
/**
* Connect to JAMS to retrieve the account
* @param username
* @param password
* @param serverUri
* @return the account id
*/
static std::string connectToAccountManager(const std::string& username,
const std::string& password,
const std::string& serverUri);
/**
* Create a new Ring or SIP account
* @param type determine if the new account will be a Ring account or a SIP one
......
......@@ -858,6 +858,25 @@ NewAccountModel::createNewAccount(profile::Type type,
if (type == profile::Type::SIP) {
details[ConfProperties::USERNAME] = uri.c_str();
}
QString accountId = ConfigurationManager::instance().addAccount(details);
return accountId.toStdString();
}
std::string
NewAccountModel::connectToAccountManager(const std::string& username,
const std::string& password,
const std::string& serverUri)
{
MapStringString details = ConfigurationManager::instance().getAccountTemplate("RING");
using namespace DRing::Account;
details[ConfProperties::TYPE] = "RING";
details[ConfProperties::USERNAME] = username.c_str();
details[ConfProperties::ARCHIVE_PASSWORD] = password.c_str();
details[ConfProperties::MANAGER_URI] = serverUri.c_str();
QString accountId = ConfigurationManager::instance().addAccount(details);
return accountId.toStdString();
}
......
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