diff --git a/src/api/newaccountmodel.h b/src/api/newaccountmodel.h index 133dd016961c08de14361957de1bb9c93d0ddc31..1e36eaa80cd94978224ee0f8af8500547c438210 100644 --- a/src/api/newaccountmodel.h +++ b/src/api/newaccountmodel.h @@ -153,11 +153,13 @@ public: * @param username * @param password * @param serverUri + * @param config * @return the account id */ static QString connectToAccountManager(const QString& username, - const QString& password, - const QString& serverUri); + const QString& password, + const QString& serverUri, + const MapStringString& config = MapStringString()); /** * Create a new Ring or SIP account @@ -168,6 +170,7 @@ public: * @param password of the archive (unused for SIP) * @param pin of the archive (unused for SIP) * @param uri of the account (for SIP) + * @param config * @return the created account */ static QString createNewAccount(profile::Type type, @@ -175,7 +178,8 @@ public: const QString& archivePath = "", const QString& password = "", const QString& pin = "", - const QString& uri = ""); + const QString& uri = "", + const MapStringString& config = MapStringString()); /** * Set an account to the first position diff --git a/src/newaccountmodel.cpp b/src/newaccountmodel.cpp index 7702be09b039523c57df03185bae971ea9c1cf2f..43bb45e30192aed86cbb05c3cffc8a678f0495aa 100644 --- a/src/newaccountmodel.cpp +++ b/src/newaccountmodel.cpp @@ -942,7 +942,8 @@ NewAccountModel::createNewAccount(profile::Type type, const QString& archivePath, const QString& password, const QString& pin, - const QString& uri) + const QString& uri, + const MapStringString& config) { MapStringString details = type == profile::Type::SIP? @@ -956,8 +957,12 @@ NewAccountModel::createNewAccount(profile::Type type, details[ConfProperties::ARCHIVE_PASSWORD] = password; details[ConfProperties::ARCHIVE_PIN] = pin; details[ConfProperties::ARCHIVE_PATH] = archivePath; - if (type == profile::Type::SIP) { + if (type == profile::Type::SIP) details[ConfProperties::USERNAME] = uri; + if (!config.isEmpty()) { + for (MapStringString::const_iterator it = config.begin(); it != config.end(); it++) { + details[it.key()] = it.value(); + } } QString accountId = ConfigurationManager::instance().addAccount(details); @@ -967,7 +972,8 @@ NewAccountModel::createNewAccount(profile::Type type, QString NewAccountModel::connectToAccountManager(const QString& username, const QString& password, - const QString& serverUri) + const QString& serverUri, + const MapStringString& config) { MapStringString details = ConfigurationManager::instance().getAccountTemplate("RING"); using namespace DRing::Account; @@ -975,6 +981,11 @@ NewAccountModel::connectToAccountManager(const QString& username, details[ConfProperties::MANAGER_URI] = serverUri; details[ConfProperties::MANAGER_USERNAME] = username; details[ConfProperties::ARCHIVE_PASSWORD] = password; + if (!config.isEmpty()) { + for (MapStringString::const_iterator it = config.begin(); it != config.end(); it++) { + details[it.key()] = it.value(); + } + } QString accountId = ConfigurationManager::instance().addAccount(details); return accountId;