mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-17 13:24:15 -05:00
Added in Libresapi: Getting node name in PeersHandler
This commit is contained in:
parent
2db25d40cb
commit
b24d772278
@ -250,6 +250,7 @@ PeersHandler::PeersHandler( StateTokenServer* sts, RsNotify* notify,
|
|||||||
addResourceHandler("set_network_options", this, &PeersHandler::handleSetNetworkOptions);
|
addResourceHandler("set_network_options", this, &PeersHandler::handleSetNetworkOptions);
|
||||||
addResourceHandler("get_pgp_options", this, &PeersHandler::handleGetPGPOptions);
|
addResourceHandler("get_pgp_options", this, &PeersHandler::handleGetPGPOptions);
|
||||||
addResourceHandler("set_pgp_options", this, &PeersHandler::handleSetPGPOptions);
|
addResourceHandler("set_pgp_options", this, &PeersHandler::handleSetPGPOptions);
|
||||||
|
addResourceHandler("get_node_name", this, &PeersHandler::handleGetNodeName);
|
||||||
addResourceHandler("get_node_options", this, &PeersHandler::handleGetNodeOptions);
|
addResourceHandler("get_node_options", this, &PeersHandler::handleGetNodeOptions);
|
||||||
addResourceHandler("set_node_options", this, &PeersHandler::handleSetNodeOptions);
|
addResourceHandler("set_node_options", this, &PeersHandler::handleSetNodeOptions);
|
||||||
addResourceHandler("examine_cert", this, &PeersHandler::handleExamineCert);
|
addResourceHandler("examine_cert", this, &PeersHandler::handleExamineCert);
|
||||||
@ -1139,6 +1140,28 @@ void PeersHandler::handleSetPGPOptions(Request& req, Response& resp)
|
|||||||
resp.setOk();
|
resp.setOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PeersHandler::handleGetNodeName(Request& req, Response& resp)
|
||||||
|
{
|
||||||
|
std::string peer_id;
|
||||||
|
req.mStream << makeKeyValueReference("peer_id", peer_id);
|
||||||
|
|
||||||
|
RsPeerId peerId(peer_id);
|
||||||
|
RsPeerDetails detail;
|
||||||
|
if(!mRsPeers->getPeerDetails(peerId, detail))
|
||||||
|
{
|
||||||
|
resp.setFail();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
resp.mDataStream << makeKeyValue("peer_id", detail.id.toStdString());
|
||||||
|
resp.mDataStream << makeKeyValue("name", detail.name);
|
||||||
|
resp.mDataStream << makeKeyValue("location", detail.location);
|
||||||
|
resp.mDataStream << makeKeyValue("pgp_id", detail.gpg_id.toStdString());
|
||||||
|
resp.mDataStream << makeKeyValue("last_contact", detail.lastConnect);
|
||||||
|
|
||||||
|
resp.setOk();
|
||||||
|
}
|
||||||
|
|
||||||
void PeersHandler::handleGetNodeOptions(Request& req, Response& resp)
|
void PeersHandler::handleGetNodeOptions(Request& req, Response& resp)
|
||||||
{
|
{
|
||||||
std::string peer_id;
|
std::string peer_id;
|
||||||
|
@ -70,6 +70,7 @@ private:
|
|||||||
void handleGetPGPOptions(Request& req, Response& resp);
|
void handleGetPGPOptions(Request& req, Response& resp);
|
||||||
void handleSetPGPOptions(Request& req, Response& resp);
|
void handleSetPGPOptions(Request& req, Response& resp);
|
||||||
|
|
||||||
|
void handleGetNodeName(Request& req, Response& resp);
|
||||||
void handleGetNodeOptions(Request& req, Response& resp);
|
void handleGetNodeOptions(Request& req, Response& resp);
|
||||||
void handleSetNodeOptions(Request& req, Response& resp);
|
void handleSetNodeOptions(Request& req, Response& resp);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user