Commit 51c15915 authored by Sébastien Blin's avatar Sébastien Blin Committed by Adrien Béraud

jams: retrieve parameters provided by the account manager

Change-Id: Ib8b1379ca719350de95ab353f56712a02d9278fa
parent e859f98c
......@@ -1305,6 +1305,12 @@ JamiAccount::loadAccount(const std::string& archive_password,
Migration::setState(getAccountID(), Migration::State::SUCCESS);
}
// Use the provided config by JAMS instead of default one
auto details = getAccountDetails();
for (const auto& [key, value] : config)
details[key] = value;
setAccountDetails(details);
if (not info.photo.empty() or not displayName_.empty())
emitSignal<DRing::ConfigurationSignal::AccountProfileReceived>(getAccountID(),
displayName_,
......
......@@ -171,20 +171,20 @@ ServerAccountManager::initAuthentication(PrivateKey key,
this_.creds_ = std::move(ctx->credentials);
this_.info_ = std::move(info);
std::map<std::string, std::string> config;
if (json.isMember("nameServer")) {
auto nameServer = json["nameServer"].asString();
if (!nameServer.empty() && nameServer[0] == '/')
nameServer = this_.managerHostname_ + nameServer;
this_.nameDir_ = NameDirectory::instance(nameServer);
config.emplace(DRing::Account::ConfProperties::RingNS::URI,
std::move(nameServer));
}
if (json.isMember("displayName")) {
config.emplace(DRing::Account::ConfProperties::DISPLAYNAME,
json["displayName"].asString());
}
if (json.isMember("userPhoto")) {
this_.info_->photo = json["userPhoto"].asString();
for (auto itr = json.begin(); itr != json.end(); ++itr) {
const auto& name = itr.name();
if (name == "nameServer"sv) {
auto nameServer = json["nameServer"].asString();
if (!nameServer.empty() && nameServer[0] == '/')
nameServer = this_.managerHostname_ + nameServer;
this_.nameDir_ = NameDirectory::instance(nameServer);
config.emplace(DRing::Account::ConfProperties::RingNS::URI,
std::move(nameServer));
} else if (name == "userPhoto"sv) {
this_.info_->photo = json["userPhoto"].asString();
} else {
config.emplace(name, itr->asString());
}
}
ctx->onSuccess(*this_.info_,
......
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