diff --git a/src/api/newaccountmodel.h b/src/api/newaccountmodel.h index d178782eb0ade13f02a311a912465b6903e56b5a..2f1c667547b2affac9ae3c498ff2a2293350be6b 100644 --- a/src/api/newaccountmodel.h +++ b/src/api/newaccountmodel.h @@ -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 diff --git a/src/newaccountmodel.cpp b/src/newaccountmodel.cpp index 04208dbcb15b0b44ba702555b2c865c07a783764..babe12873f1d6705657ac2d9b712fa4cafb735b7 100644 --- a/src/newaccountmodel.cpp +++ b/src/newaccountmodel.cpp @@ -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(); }