mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Added: Handling requests to set opinion about identity
This commit is contained in:
parent
120ca9d078
commit
b43bedf669
@ -148,6 +148,7 @@ IdentityHandler::IdentityHandler(StateTokenServer *sts, RsNotify *notify, RsIden
|
||||
addResourceHandler("get_identity_details", this, &IdentityHandler::handleGetIdentityDetails);
|
||||
|
||||
addResourceHandler("set_ban_node", this, &IdentityHandler::handleSetBanNode);
|
||||
addResourceHandler("set_opinion", this, &IdentityHandler::handleSetOpinion);
|
||||
}
|
||||
|
||||
IdentityHandler::~IdentityHandler()
|
||||
@ -487,6 +488,36 @@ void IdentityHandler::handleSetBanNode(Request& req, Response& resp)
|
||||
resp.setOk();
|
||||
}
|
||||
|
||||
void IdentityHandler::handleSetOpinion(Request& req, Response& resp)
|
||||
{
|
||||
std::string gxs_id;
|
||||
req.mStream << makeKeyValueReference("gxs_id", gxs_id);
|
||||
RsGxsId gxsId(gxs_id);
|
||||
|
||||
int own_opinion;
|
||||
req.mStream << makeKeyValueReference("own_opinion", own_opinion);
|
||||
|
||||
RsReputations::Opinion opinion;
|
||||
switch(own_opinion)
|
||||
{
|
||||
case 0:
|
||||
opinion = RsReputations::OPINION_NEGATIVE;
|
||||
break;
|
||||
case 1: opinion =
|
||||
RsReputations::OPINION_NEUTRAL;
|
||||
break;
|
||||
case 2:
|
||||
opinion = RsReputations::OPINION_POSITIVE;
|
||||
break;
|
||||
default:
|
||||
resp.setFail();
|
||||
return;
|
||||
}
|
||||
rsReputations->setOwnOpinion(gxsId, opinion);
|
||||
|
||||
resp.setOk();
|
||||
}
|
||||
|
||||
ResponseTask* IdentityHandler::handleOwn(Request & /* req */, Response &resp)
|
||||
{
|
||||
StateToken state;
|
||||
|
@ -32,6 +32,7 @@ private:
|
||||
void handleGetIdentityDetails(Request& req, Response& resp);
|
||||
|
||||
void handleSetBanNode(Request& req, Response& resp);
|
||||
void handleSetOpinion(Request& req, Response& resp);
|
||||
|
||||
ResponseTask *handleOwn(Request& req, Response& resp);
|
||||
ResponseTask *handleCreateIdentity(Request& req, Response& resp);
|
||||
|
Loading…
Reference in New Issue
Block a user