Some new PF API support.

This commit is contained in:
JoelKatz
2013-04-29 23:31:25 -07:00
parent 50d40115e5
commit 707f914d32
6 changed files with 123 additions and 17 deletions

View File

@@ -21,6 +21,7 @@
#include "NicknameState.h"
#include "InstanceCounter.h"
#include "Offer.h"
#include "PFRequest.h"
SETUP_LOG();
@@ -1174,17 +1175,29 @@ Json::Value RPCHandler::doPathFind(Json::Value jvRequest, int& cost, ScopedLock&
if (sSubCommand == "create")
{
// WRITEME
mInfoSub->clearPFRequest();
PFRequest::pointer request = boost::make_shared<PFRequest>(mInfoSub);
Json::Value result = request->doCreate(jvRequest);
if (request->isValid())
mInfoSub->setPFRequest(request);
return result;
}
if (sSubCommand == "close")
{
// WRITEME
PFRequest::pointer request = mInfoSub->getPFRequest();
if (!request)
return rpcNO_PF_REQUEST;
mInfoSub->clearPFRequest();
return request->doClose(jvRequest);
}
if (sSubCommand == "status")
{
// WRITEME
PFRequest::pointer request = mInfoSub->getPFRequest();
if (!request)
return rpcNO_PF_REQUEST;
return request->doStatus(jvRequest);
}
return rpcError(rpcINVALID_PARAMS);