mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04: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())
|
||||
@ -108,6 +139,7 @@ IdentityHandler::IdentityHandler(StateTokenServer *sts, RsNotify *notify, RsIden
|
||||
addResourceHandler("notown_ids", this, &IdentityHandler::handleNotOwnIdsRequest);
|
||||
|
||||
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