Commit 879185f8 authored by Olivier Dion's avatar Olivier Dion

agent: Use static account ID

Change-Id: I68e954bc8de9548a9da0026c014f27141e0b7ec0
parent c57b956a
......@@ -77,12 +77,6 @@ Agent::configure(const std::string& yaml_config)
YAML::Node node = YAML::Load(file);
auto account = node["account-id"];
AGENT_ASSERT(account.IsScalar(), "Bad or missing field `account-id`");
accountID_ = account.as<std::string>();
auto peers = node["peers"];
AGENT_ASSERT(peers.IsSequence(), "Configuration node `peers` must be a sequence");
......@@ -131,13 +125,16 @@ Agent::ensureAccount()
details[DRing::Account::ConfProperties::ARCHIVE_PIN] = "";
details[DRing::Account::ConfProperties::ARCHIVE_PATH] = "";
accountID_ = DRing::addAccount(details);
AGENT_ASSERT(accountID_ == DRing::addAccount(details, accountID_), "Bad accountID");
wait_for_announcement_of(accountID_);
details = DRing::getAccountDetails(accountID_);
}
AGENT_ASSERT("AGENT" == details.at(DRing::Account::ConfProperties::DISPLAYNAME),
"Bad display name");
peerID_ = details.at(DRing::Account::ConfProperties::USERNAME);
}
......@@ -335,8 +332,8 @@ Agent::run(const std::string& yaml_config)
static Agent agent;
agent.initBehavior();
agent.configure(yaml_config);
agent.ensureAccount();
agent.configure(yaml_config);
agent.getConversations();
agent.installSignalHandlers();
agent.registerStaticCallbacks();
......
......@@ -90,7 +90,7 @@ class Agent
/* Bookkeeping */
std::string peerID_;
std::string accountID_;
const std::string accountID_{"afafafafafafafaf"};
std::vector<std::string> peers_;
std::vector<std::string> conversations_;
std::unique_ptr<BT::Node> root_;
......
......@@ -7,8 +7,6 @@ behavior:
peers:
- "your-peer-id"
account-id: "d65ebb0f1170ae44"
params:
- [ upnpEnabled: "true", turnEnabled: "true" ]
# - [ upnpEnabled: "true", turnEnabled: "false" ]
......
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