mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-28 08:59:37 -05:00
Added: Handling requests to delete identity
This commit is contained in:
parent
98e1a6d74c
commit
93aeae0f59
@ -95,6 +95,37 @@ protected:
|
||||
}
|
||||
};
|
||||
|
||||
class DeleteIdentityTask : public GxsResponseTask
|
||||
{
|
||||
public:
|
||||
DeleteIdentityTask(RsIdentity* idservice) :
|
||||
GxsResponseTask(idservice, idservice->getTokenService()),
|
||||
mToken(0),
|
||||
mRsIdentity(idservice)
|
||||
{}
|
||||
|
||||
protected:
|
||||
virtual void gxsDoWork(Request &req, Response &resp)
|
||||
{
|
||||
RsGxsIdGroup group;
|
||||
std::string gxs_id;
|
||||
|
||||
req.mStream << makeKeyValueReference("gxs_id", gxs_id);
|
||||
group.mMeta.mGroupId = RsGxsGroupId(gxs_id);
|
||||
|
||||
mRsIdentity->deleteIdentity(mToken, group);
|
||||
addWaitingToken(mToken);
|
||||
|
||||
done();
|
||||
return;
|
||||
}
|
||||
|
||||
private:
|
||||
uint32_t mToken;
|
||||
RsIdentity* mRsIdentity;
|
||||
RsGxsId mId;
|
||||
};
|
||||
|
||||
IdentityHandler::IdentityHandler(StateTokenServer *sts, RsNotify *notify, RsIdentity *identity):
|
||||
mStateTokenServer(sts), mNotify(notify), mRsIdentity(identity),
|
||||
mMtx("IdentityHandler Mtx"), mStateToken(sts->getNewToken())
|
||||
@ -107,7 +138,8 @@ IdentityHandler::IdentityHandler(StateTokenServer *sts, RsNotify *notify, RsIden
|
||||
addResourceHandler("own_ids", this, &IdentityHandler::handleOwnIdsRequest);
|
||||
addResourceHandler("notown_ids", this, &IdentityHandler::handleNotOwnIdsRequest);
|
||||
|
||||
addResourceHandler("create_identity", this, &IdentityHandler::handleCreateIdentity);
|
||||
addResourceHandler("create_identity", this, &IdentityHandler::handleCreateIdentity);
|
||||
addResourceHandler("delete_identity", this, &IdentityHandler::handleDeleteIdentity);
|
||||
}
|
||||
|
||||
IdentityHandler::~IdentityHandler()
|
||||
@ -302,4 +334,9 @@ ResponseTask* IdentityHandler::handleCreateIdentity(Request & /* req */, Respons
|
||||
return new CreateIdentityTask(mRsIdentity);
|
||||
}
|
||||
|
||||
ResponseTask* IdentityHandler::handleDeleteIdentity(Request& req, Response& resp)
|
||||
{
|
||||
return new DeleteIdentityTask(mRsIdentity);
|
||||
}
|
||||
|
||||
} // namespace resource_api
|
||||
|
@ -28,6 +28,7 @@ private:
|
||||
|
||||
ResponseTask *handleOwn(Request& req, Response& resp);
|
||||
ResponseTask *handleCreateIdentity(Request& req, Response& resp);
|
||||
ResponseTask *handleDeleteIdentity(Request& req, Response& resp);
|
||||
|
||||
StateTokenServer* mStateTokenServer;
|
||||
RsNotify* mNotify;
|
||||
|
Loading…
Reference in New Issue
Block a user