From d168d9e8022efde388c22dda3e441ec64bd044ae Mon Sep 17 00:00:00 2001 From: Pierre St Juste Date: Fri, 27 Jun 2014 12:29:58 -0400 Subject: [PATCH] Ability to lookup friends by uid --- src/controlleraccess.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/controlleraccess.cc b/src/controlleraccess.cc index ab31a24..60d84ee 100644 --- a/src/controlleraccess.cc +++ b/src/controlleraccess.cc @@ -129,7 +129,15 @@ void ControllerAccess::SendToPeer(int overlay_id, const std::string& uid, void ControllerAccess::SendState(const std::string& uid, bool get_stats, const talk_base::SocketAddress& addr) { ASSERT(signal_thread_->Current()); - Json::Value state = manager_.GetState(network_.friends(), get_stats); + Json::Value state; + if (uid != "") { + std::map friends; + friends[uid] = talk_base::Time(); + state = manager_.GetState(friends, get_stats); + } + else { + state = manager_.GetState(network_.friends(), get_stats); + } Json::Value local_state; local_state["_uid"] = manager_.uid(); local_state["_ip4"] = manager_.ipv4();