Skip to content
Snippets Groups Projects
Commit 16133a06 authored by Adrien Béraud's avatar Adrien Béraud
Browse files

ringaccount: save registered name in configuration

Use the account configuration to store the registered name,
allowing to know the account registered name for disabled accounts,
before account registration happens,
or if the name server is not reachable and the name cache
was cleared.

This allows to show the account registered name instead of
the RingID more consistently in clients. The field is not
authoritative as information from the name server always
take precedence.

Change-Id: Ief8725da57d609ce9bbaeda6b2d564638ea3b191
parent bd02113e
Branches
Tags
No related merge requests found
...@@ -716,6 +716,8 @@ void RingAccount::serialize(YAML::Emitter &out) ...@@ -716,6 +716,8 @@ void RingAccount::serialize(YAML::Emitter &out)
out << YAML::Key << Conf::RING_ACCOUNT_RECEIPT << YAML::Value << receipt_; out << YAML::Key << Conf::RING_ACCOUNT_RECEIPT << YAML::Value << receipt_;
out << YAML::Key << Conf::RING_ACCOUNT_RECEIPT_SIG << YAML::Value << YAML::Binary(receiptSignature_.data(), receiptSignature_.size()); out << YAML::Key << Conf::RING_ACCOUNT_RECEIPT_SIG << YAML::Value << YAML::Binary(receiptSignature_.data(), receiptSignature_.size());
out << YAML::Key << DRing::Account::ConfProperties::RING_DEVICE_NAME << YAML::Value << ringDeviceName_; out << YAML::Key << DRing::Account::ConfProperties::RING_DEVICE_NAME << YAML::Value << ringDeviceName_;
if (not registeredName_.empty())
out << YAML::Key << DRing::Account::VolatileProperties::REGISTERED_NAME << YAML::Value << registeredName_;
// tls submap // tls submap
out << YAML::Key << Conf::TLS_KEY << YAML::Value << YAML::BeginMap; out << YAML::Key << Conf::TLS_KEY << YAML::Value << YAML::BeginMap;
...@@ -747,6 +749,13 @@ void RingAccount::unserialize(const YAML::Node &node) ...@@ -747,6 +749,13 @@ void RingAccount::unserialize(const YAML::Node &node)
} catch (const std::exception& e) { } catch (const std::exception& e) {
RING_WARN("can't read device name: %s", e.what()); RING_WARN("can't read device name: %s", e.what());
} }
if (registeredName_.empty()) {
try {
parseValue(node, DRing::Account::VolatileProperties::REGISTERED_NAME, registeredName_);
} catch (const std::exception& e) {
RING_WARN("can't read device name: %s", e.what());
}
}
try { try {
parsePath(node, DRing::Account::ConfProperties::ARCHIVE_PATH, archivePath_, idPath_); parsePath(node, DRing::Account::ConfProperties::ARCHIVE_PATH, archivePath_, idPath_);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment