//------------------------------------------------------------------------
	BackgroundProcessTicket ResourceBackgroundQueue::prepareResourceGroup(
		const String& name, ResourceBackgroundQueue::Listener* listener)
	{
#if OGRE_THREAD_SUPPORT
		// queue a request
		ResourceRequest req;
		req.type = RT_PREPARE_GROUP;
		req.groupName = name;
		req.listener = listener;
		return addRequest(req);
#else
		// synchronous
		ResourceGroupManager::getSingleton().prepareResourceGroup(name);
		return 0; 
#endif
	}
Example #2
0
void DropboxStorage::getAccessToken(Common::String code) {
    if (!KEY || !SECRET)
        loadKeyAndSecret();
    Networking::JsonCallback callback = new Common::Callback<DropboxStorage, Networking::JsonResponse>(this, &DropboxStorage::codeFlowComplete);
    Networking::ErrorCallback errorCallback = new Common::Callback<DropboxStorage, Networking::ErrorResponse>(this, &DropboxStorage::codeFlowFailed);
    Networking::CurlJsonRequest *request = new Networking::CurlJsonRequest(callback, errorCallback, DROPBOX_OAUTH2_TOKEN);
    request->addPostField("code=" + code);
    request->addPostField("grant_type=authorization_code");
    request->addPostField("client_id=" + Common::String(KEY));
    request->addPostField("client_secret=" + Common::String(SECRET));
    if (Cloud::CloudManager::couldUseLocalServer()) {
        request->addPostField("&redirect_uri=http%3A%2F%2Flocalhost%3A12345%2F");
    } else {
        request->addPostField("&redirect_uri=https%3A%2F%2Fwww.scummvm.org/c/code");
    }
    addRequest(request);
}
	//------------------------------------------------------------------------
	void ResourceBackgroundQueue::shutdown(void)
	{
#if OGRE_THREAD_SUPPORT
		if (mThread)
		{
			// Put a shutdown request on the queue
			Request req;
			req.type = RT_SHUTDOWN;
			addRequest(req);
			// Wait for thread to finish
			mThread->join();
			OGRE_DELETE_T(mThread, thread, MEMCATEGORY_RESOURCE);
			mThread = 0;
			mRequestQueue.clear();
			mRequestTicketMap.clear();
		}
#endif
	}
LLVFSThread::handle_t LLVFSThread::write(LLVFS* vfs, const LLUUID &file_id, const LLAssetType::EType file_type,
										 U8* buffer, S32 offset, S32 numbytes, U32 flags)
{
	handle_t handle = generateHandle();

	Request* req = new Request(handle, 0, flags, FILE_WRITE, vfs, file_id, file_type,
							   buffer, offset, numbytes);

	bool res = addRequest(req);
	if (!res)
	{
		LL_ERRS() << "LLVFSThread::read called after LLVFSThread::cleanupClass()" << LL_ENDL;
		req->deleteRequest();
		handle = nullHandle();
	}
	
	return handle;
}
LLVFSThread::handle_t LLVFSThread::read(LLVFS* vfs, const LLUUID &file_id, const LLAssetType::EType file_type,
										U8* buffer, S32 offset, S32 numbytes, U32 priority, U32 flags)
{
	handle_t handle = generateHandle();

	priority = llmax(priority, (U32)PRIORITY_LOW); // All reads are at least PRIORITY_LOW
	Request* req = new Request(handle, priority, flags, FILE_READ, vfs, file_id, file_type,
							   buffer, offset, numbytes);

	bool res = addRequest(req);
	if (!res)
	{
		LL_ERRS() << "LLVFSThread::read called after LLVFSThread::cleanupClass()" << LL_ENDL;
		req->deleteRequest();
		handle = nullHandle();
	}

	return handle;
}
Example #6
0
Networking::Request *IdStorage::createDirectory(Common::String path, BoolCallback callback, Networking::ErrorCallback errorCallback) {
	if (!errorCallback)
		errorCallback = getErrorPrintingCallback();
	if (!callback)
		callback = new Common::Callback<IdStorage, BoolResponse>(this, &IdStorage::printBool);

	//find out the parent path and directory name
	Common::String parentPath = "", directoryName = path;
	for (uint32 i = path.size(); i > 0; --i) {
		if (path[i - 1] == '/' || path[i - 1] == '\\') {
			parentPath = path;
			parentPath.erase(i - 1);
			directoryName.erase(0, i);
			break;
		}
	}

	return addRequest(new IdCreateDirectoryRequest(this, parentPath, directoryName, callback, errorCallback));
}
Example #7
0
bool IRCSession::handleResponse(const std::string &command)
{
	IRCParser parser;
	shared_ptr<IIRCCommand> response = parser.parse(get_this_ptr(), command);
	if(response != nullptr)
	{
		processResponse(response);
		notifyCommand(response);

	    shared_ptr<IIRCCommand> reply = response->getReply();
		if(reply != nullptr)
			addRequest(reply, false);
	}
	else
	{
		OS_LOG_DEBUG(_S("Unknown IRC command '") + command + _S("'"));
	}

	return parser.getAlive();
}
	//---------------------------------------------------------------------
	BackgroundProcessTicket ResourceBackgroundQueue::unload(
		const String& resType, ResourceHandle handle, Listener* listener)
	{
#if OGRE_THREAD_SUPPORT
		// queue a request
		ResourceRequest req;
		req.type = RT_UNLOAD_RESOURCE;
		req.resourceType = resType;
		req.resourceHandle = handle;
		req.listener = listener;
		return addRequest(req);
#else
		// synchronous
		ResourceManager* rm = 
			ResourceGroupManager::getSingleton()._getResourceManager(resType);
		rm->unload(handle);
		return 0; 
#endif

	}
LLLFSThread::handle_t LLLFSThread::write(const std::string& filename,
										 U8* buffer, S32 offset, S32 numbytes,
										 Responder* responder, U32 priority)
{
	handle_t handle = generateHandle();

	if (priority == 0) priority = PRIORITY_LOW | priorityCounter();
	
	Request* req = new Request(this, handle, priority,
							   FILE_WRITE, filename,
							   buffer, offset, numbytes,
							   responder);

	bool res = addRequest(req);
	if (!res)
	{
		llerrs << "LLLFSThread::read called after LLLFSThread::cleanupClass()" << llendl;
	}
	
	return handle;
}
Example #10
0
// MAIN THREAD
// virtual
S32 LLImageDecodeThread::update(U32 max_time_ms)
{
	LLMutexLock lock(mCreationMutex);
	for (creation_list_t::iterator iter = mCreationList.begin();
		 iter != mCreationList.end(); ++iter)
	{
		creation_info& info = *iter;
		ImageRequest* req = new ImageRequest(info.handle, info.image,
						     info.priority, info.discard, info.needs_aux,
						     info.responder);

		bool res = addRequest(req);
		if (!res)
		{
			llerrs << "request added after LLLFSThread::cleanupClass()" << llendl;
		}
	}
	mCreationList.clear();
	S32 res = LLQueuedThread::update(max_time_ms);
	return res;
}
Example #11
0
Networking::Request *BoxStorage::createDirectoryWithParentId(Common::String parentId, Common::String name, BoolCallback callback, Networking::ErrorCallback errorCallback) {
	if (!errorCallback)
		errorCallback = getErrorPrintingCallback();

	Common::String url = BOX_API_FOLDERS;
	Networking::JsonCallback innerCallback = new Common::CallbackBridge<BoxStorage, BoolResponse, Networking::JsonResponse>(this, &BoxStorage::createDirectoryInnerCallback, callback);
	Networking::CurlJsonRequest *request = new BoxTokenRefresher(this, innerCallback, errorCallback, url.c_str());
	request->addHeader("Authorization: Bearer " + accessToken());
	request->addHeader("Content-Type: application/json");

	Common::JSONObject parentObject;
	parentObject.setVal("id", new Common::JSONValue(parentId));

	Common::JSONObject jsonRequestParameters;
	jsonRequestParameters.setVal("name", new Common::JSONValue(name));
	jsonRequestParameters.setVal("parent", new Common::JSONValue(parentObject));

	Common::JSONValue value(jsonRequestParameters);
	request->addPostField(Common::JSON::stringify(&value));

	return addRequest(request);
}
Example #12
0
LLLFSThread::handle_t LLLFSThread::read(const std::string& filename,	/* Flawfinder: ignore */ 
										U8* buffer, S32 offset, S32 numbytes,
										Responder* responder, U32 priority)
{
	handle_t handle = generateHandle();

	if (priority == 0) priority = PRIORITY_NORMAL | priorityCounter();
	else if (priority < PRIORITY_LOW) priority |= PRIORITY_LOW; // All reads are at least PRIORITY_LOW

	Request* req = new Request(this, handle, priority,
							   FILE_READ, filename,
							   buffer, offset, numbytes,
							   responder);

	bool res = addRequest(req);
	if (!res)
	{
		llerrs << "LLLFSThread::read called after LLLFSThread::cleanupClass()" << llendl;
	}

	return handle;
}
    /** This function inserts a high priority request to quit into the request
     *  queue of the network thead, and also aborts any ongoing download.
     *  Separating this allows more time for the thread to finish cleanly,
     *  before it gets cancelled in the destructor.
     */
    void RequestManager::stopNetworkThread()
    {
        // This will queue a sign-out or client-quit request
        PlayerManager::onSTKQuit();

        // Put in a high priortity quit request in. It has the same priority
        // as a sign-out request (so the sign-out will be executed before the
        // quit request).
        Request *quit = new Request(true, HTTP_MAX_PRIORITY, Request::RT_QUIT);
        quit->setAbortable(false);
        addRequest(quit);

        // It is possible that downloads are still ongoing (either an addon
        // download that the user aborted, or the addon icons etc are still
        // queued). In order to allow a quick exit of stk we set a flag that
        // will cause libcurl to abort downloading asap, and then allow the
        // other requests (sign-out and quit) to be executed asap. Note that
        // the sign-out request is set to be not abortable, so it still will
        // be executed (before the quit request is executed, which causes this
        // thread to exit).
        m_abort.setAtomic(true);
    }   // stopNetworkThread
S32 LLVFSThread::readImmediate(LLVFS* vfs, const LLUUID &file_id, const LLAssetType::EType file_type,
							   U8* buffer, S32 offset, S32 numbytes)
{
	handle_t handle = generateHandle();

	Request* req = new Request(handle, PRIORITY_IMMEDIATE, 0, FILE_READ, vfs, file_id, file_type,
							   buffer, offset, numbytes);
	
	S32 res = addRequest(req) ? 1 : 0;
	if (res == 0)
	{
		LL_ERRS() << "LLVFSThread::read called after LLVFSThread::cleanupClass()" << LL_ENDL;
		req->deleteRequest();
	}
	else
	{
		llverify(waitForResult(handle, false) == true);
		res = req->getBytesRead();
		completeRequest(handle);
	}
	return res;
}
Example #15
0
bool IRCSession::initLoginRequest()
{
	std::string nick = getNick();
	std::string user = getUser();
	if(user.empty())
		user = nick;
	std::string clientName = getClientName();

	OS_ASSERT(nick.empty() == false);
	OS_ASSERT(user.empty() == false);
	OS_ASSERT(clientName.empty() == false);

	std::string command;
	command.append("PASS NOPASS");
	command.append(OS_IRC_COMMANDS_TERMINATOR);	
	command.append("NICK " + nick);
	command.append(OS_IRC_COMMANDS_TERMINATOR);			
	command.append("USER " + user + " USING " + clientName + " :" + nick);
	command.append(OS_IRC_COMMANDS_TERMINATOR);

	return addRequest(shared_ptr<IIRCCommand>(OS_NEW IRCCommandRaw(get_this_ptr(), command)), false);
}
	//------------------------------------------------------------------------
	BackgroundProcessTicket 
	ResourceBackgroundQueue::initialiseAllResourceGroups( 
		ResourceBackgroundQueue::Listener* listener)
	{
#if OGRE_THREAD_SUPPORT
		if (!mThread && mStartThread)
		{
			OGRE_EXCEPT(Exception::ERR_INTERNAL_ERROR, 
				"Thread not initialised",
				"ResourceBackgroundQueue::initialiseAllResourceGroups");
		}
		// queue a request
		Request req;
		req.type = RT_INITIALISE_ALL_GROUPS;
		req.listener = listener;
		return addRequest(req);
#else
		// synchronous
		ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
		return 0; 
#endif
	}
	//------------------------------------------------------------------------
	BackgroundProcessTicket ResourceBackgroundQueue::loadResourceGroup(
		const String& name, ResourceBackgroundQueue::Listener* listener)
	{
#if OGRE_THREAD_SUPPORT
		if (!mThread && mStartThread)
		{
			OGRE_EXCEPT(Exception::ERR_INTERNAL_ERROR, 
				"Thread not initialised",
				"ResourceBackgroundQueue::loadResourceGroup");
		}
		// queue a request
		Request req;
		req.type = RT_LOAD_GROUP;
		req.groupName = name;
		req.listener = listener;
		return addRequest(req);
#else
		// synchronous
		ResourceGroupManager::getSingleton().loadResourceGroup(name);
		return 0; 
#endif
	}
Example #18
0
static void dispatch_operation(struct session *session, DNDSMessage_t *msg)
{
	dsop_PR operation;
	DSMessage_get_operation(msg, &operation);

	switch (operation) {
	case dsop_PR_nodeConnectInfo:
		nodeConnectInfo(session, msg);
		break;

	case dsop_PR_addRequest:
		addRequest(msg);
		break;

	case dsop_PR_delRequest:
		delRequest(session, msg);
		break;

	case dsop_PR_modifyRequest:
		modifyRequest(session, msg);
		break;

	case dsop_PR_searchRequest:
		searchRequest(session, msg);
		break;

	/* terminateRequest is a special case since
	 * it has no Response message associated with it.
	 * simply disconnect the client;
	 */
	case dsop_PR_NOTHING:
	default:
		jlog(L_WARNING, "not a valid DSM operation");
	case dsop_PR_terminateRequest:
		terminate(session);
		break;
	}
}
Example #19
0
Networking::Request *GoogleDriveStorage::createDirectoryWithParentId(Common::String parentId, Common::String name, BoolCallback callback, Networking::ErrorCallback errorCallback) {
	if (!errorCallback)
		errorCallback = getErrorPrintingCallback();

	Common::String url = GOOGLEDRIVE_API_FILES;
	Networking::JsonCallback innerCallback = new Common::CallbackBridge<GoogleDriveStorage, BoolResponse, Networking::JsonResponse>(this, &GoogleDriveStorage::createDirectoryInnerCallback, callback);
	Networking::CurlJsonRequest *request = new GoogleDriveTokenRefresher(this, innerCallback, errorCallback, url.c_str());
	request->addHeader("Authorization: Bearer " + accessToken());
	request->addHeader("Content-Type: application/json");

	Common::JSONArray parentsArray;
	parentsArray.push_back(new Common::JSONValue(parentId));

	Common::JSONObject jsonRequestParameters;
	jsonRequestParameters.setVal("mimeType", new Common::JSONValue("application/vnd.google-apps.folder"));
	jsonRequestParameters.setVal("name", new Common::JSONValue(name));
	jsonRequestParameters.setVal("parents", new Common::JSONValue(parentsArray));

	Common::JSONValue value(jsonRequestParameters);
	request->addPostField(Common::JSON::stringify(&value));

	return addRequest(request);
}
Example #20
0
int ExtConn::assignReq(ExtRequest *pReq)
{
    int ret;

    if (getState() > PROCESSING)
        close();
    assert(!m_iInProcess);
//    if ( m_iInProcess )
//    {
//        LS_WARN(this, "[ExtConn] connection is still in middle of a request,"
//                " close before assign a new request");
//        close();
//    }
    m_iCPState = 0;
    ret = addRequest(pReq);
    if (ret)
    {
        if (ret == -1)
            ret = SC_500;
        pReq->setHttpError(ret);
        return ret;
    }
    m_tmLastAccess = DateTime::s_curTime;
    if (getState() == PROCESSING)
    {
        ret = doWrite();
        onEventDone();
        //pConn->continueWrite();
    }
    else if (getState() != CONNECTING)
        ret = reconnect();
    if (ret == -1)
        return connError(errno);
    return 0;

}
Example #21
0
int askMaxClientDataSize(Connection* connection) {
    Request* request = NULL;
    Package* package = NULL;

    request = createRequest(connection, MAXDATASIZE);

    request->count_mutex = malloc(sizeof (pthread_mutex_t));
    request->count_threshold_cv = malloc(sizeof (pthread_cond_t));
    pthread_cond_init(request->count_threshold_cv, NULL);
    pthread_mutex_init(request->count_mutex, NULL);
    pthread_mutex_lock(request->count_mutex);

    addRequest(request);

    pthread_cond_wait(request->count_threshold_cv, request->count_mutex);

    package = receivePackage(connection);

    pthread_mutex_unlock(request->count_mutex);
    pthread_cond_destroy(request->count_threshold_cv);
    pthread_mutex_destroy(request->count_mutex);

    return atoi(package->dados);
}
Example #22
0
Networking::Request *BoxStorage::info(StorageInfoCallback callback, Networking::ErrorCallback errorCallback) {
	Networking::JsonCallback innerCallback = new Common::CallbackBridge<BoxStorage, StorageInfoResponse, Networking::JsonResponse>(this, &BoxStorage::infoInnerCallback, callback);
	Networking::CurlJsonRequest *request = new BoxTokenRefresher(this, innerCallback, errorCallback, BOX_API_USERS_ME);
	request->addHeader("Authorization: Bearer " + _token);
	return addRequest(request);
}
Example #23
0
Networking::Request *BoxStorage::upload(Common::String remotePath, Common::String localPath, UploadCallback callback, Networking::ErrorCallback errorCallback) {
	if (!errorCallback)
		errorCallback = getErrorPrintingCallback();
	return addRequest(new BoxUploadRequest(this, remotePath, localPath, callback, errorCallback));
}
Networking::Request *OneDriveStorage::info(StorageInfoCallback callback, Networking::ErrorCallback errorCallback) {
	Networking::JsonCallback innerCallback = new Common::CallbackBridge<OneDriveStorage, StorageInfoResponse, Networking::JsonResponse>(this, &OneDriveStorage::infoInnerCallback, callback);
	Networking::CurlJsonRequest *request = new OneDriveTokenRefresher(this, innerCallback, errorCallback, ONEDRIVE_API_SPECIAL_APPROOT);
	request->addHeader("Authorization: bearer " + _token);
	return addRequest(request);
}
Example #25
0
Networking::Request *IdStorage::streamFile(Common::String path, Networking::NetworkReadStreamCallback outerCallback, Networking::ErrorCallback errorCallback) {
	return addRequest(new IdStreamFileRequest(this, path, outerCallback, errorCallback));
}
Example #26
0
Networking::Request *IdStorage::download(Common::String remotePath, Common::String localPath, BoolCallback callback, Networking::ErrorCallback errorCallback) {
	return addRequest(new IdDownloadRequest(this, remotePath, localPath, callback, errorCallback));
}
Example #27
0
void
NLHandler::myStartElement(int element,
                          const SUMOSAXAttributes& attrs) {
    try {
        switch (element) {
            case SUMO_TAG_EDGE:
                beginEdgeParsing(attrs);
                break;
            case SUMO_TAG_LANE:
                addLane(attrs);
                break;
            case SUMO_TAG_POLY:
                addPoly(attrs);
                break;
            case SUMO_TAG_POI:
                addPOI(attrs);
                break;
            case SUMO_TAG_JUNCTION:
                openJunction(attrs);
                initJunctionLogic(attrs);
                break;
            case SUMO_TAG_PHASE:
                addPhase(attrs);
                break;
            case SUMO_TAG_CONNECTION:
                addConnection(attrs);
                break;
            case SUMO_TAG_TLLOGIC:
                initTrafficLightLogic(attrs);
                break;
            case SUMO_TAG_REQUEST:
                addRequest(attrs);
                break;
            case SUMO_TAG_WAUT:
                openWAUT(attrs);
                break;
            case SUMO_TAG_WAUT_SWITCH:
                addWAUTSwitch(attrs);
                break;
            case SUMO_TAG_WAUT_JUNCTION:
                addWAUTJunction(attrs);
                break;
            case SUMO_TAG_E1DETECTOR:
            case SUMO_TAG_INDUCTION_LOOP:
                addE1Detector(attrs);
                break;
            case SUMO_TAG_E2DETECTOR:
            case SUMO_TAG_LANE_AREA_DETECTOR:
                addE2Detector(attrs);
                break;
            case SUMO_TAG_E3DETECTOR:
            case SUMO_TAG_ENTRY_EXIT_DETECTOR:
                beginE3Detector(attrs);
                break;
            case SUMO_TAG_DET_ENTRY:
                addE3Entry(attrs);
                break;
            case SUMO_TAG_DET_EXIT:
                addE3Exit(attrs);
                break;
            case SUMO_TAG_INSTANT_INDUCTION_LOOP:
                addInstantE1Detector(attrs);
                break;
            case SUMO_TAG_VSS:
                myTriggerBuilder.parseAndBuildLaneSpeedTrigger(myNet, attrs, getFileName());
                break;
            case SUMO_TAG_CALIBRATOR:
                myTriggerBuilder.parseAndBuildCalibrator(myNet, attrs, getFileName());
                break;
            case SUMO_TAG_REROUTER:
                myTriggerBuilder.parseAndBuildRerouter(myNet, attrs, getFileName());
                break;
            case SUMO_TAG_BUS_STOP:
                myTriggerBuilder.parseAndBuildBusStop(myNet, attrs);
                break;
            case SUMO_TAG_VTYPEPROBE:
                addVTypeProbeDetector(attrs);
                break;
            case SUMO_TAG_ROUTEPROBE:
                addRouteProbeDetector(attrs);
                break;
            case SUMO_TAG_MEANDATA_EDGE:
                addEdgeLaneMeanData(attrs, SUMO_TAG_MEANDATA_EDGE);
                break;
            case SUMO_TAG_MEANDATA_LANE:
                addEdgeLaneMeanData(attrs, SUMO_TAG_MEANDATA_LANE);
                break;
            case SUMO_TAG_TIMEDEVENT:
                myActionBuilder.addAction(attrs, getFileName());
                break;
            case SUMO_TAG_VAPORIZER:
                myTriggerBuilder.buildVaporizer(attrs);
                break;
            case SUMO_TAG_LOCATION:
                setLocation(attrs);
                break;
            case SUMO_TAG_TAZ:
                addDistrict(attrs);
                break;
            case SUMO_TAG_TAZSOURCE:
                addDistrictEdge(attrs, true);
                break;
            case SUMO_TAG_TAZSINK:
                addDistrictEdge(attrs, false);
                break;
            default:
                break;
        }
    } catch (InvalidArgument& e) {
        WRITE_ERROR(e.what());
    }
    MSRouteHandler::myStartElement(element, attrs);
    if (element == SUMO_TAG_PARAM) {
        addParam(attrs);
    }
}
// -------------------------------------------------------------------
// convertTextToApiRequest:
//
// return TRUE is successful, FALSE otherwise
// -------------------------------------------------------------------
short 
CatApiRequestList::convertTextToApiRequest (const char *text
                                            // , size_t textLen
                                            // , short /*SQLCHARSET_CODE*/ ddlTextCharSet
                                            )
{
  // The first item in the string is the operation type.  Just verify
  // that the correct verbage exists.
  size_t startPos = 0;
  char buf[MAXPARAMSIZE];
  Lng32 scanCount;
  char * endPos = (char *) strchr( text, '&' );
  size_t strPos = endPos - text;
  if (strPos < startPos)
    return 0; // failure
  size_t len = strPos - startPos;
  strncpy (buf, &text[startPos], len);
  buf[strPos] = '\0';
  startPos = ++strPos;
  
  // Get the version control information
  endPos = (char *) strchr( &text[startPos], ' ');
  strPos = endPos - text;
  if (strPos < startPos)
    return 0; // failure
  len = (strPos - startPos);
  delete [] versionInfo_;
  versionInfo_ = new char[len+1];
  strncpy (versionInfo_, &text[startPos], len);
  versionInfo_[len] = '\0';
  if (strcmp(versionInfo_, APIVERSION) != 0)
    return 0;

  // Get list type
  startPos = ++strPos;
  endPos = (char *) strchr(&text[startPos], ' ');
  strPos = (endPos - text);
  if (strPos < startPos)
    return 0; // failure
  len = (strPos - startPos);
  strncpy (buf, &text[startPos], len);
  buf[len] = '\0';
  if (strcmp(buf, APILIST) != 0)
    return 0;

  // Get number requests
  startPos = ++strPos;
  endPos = (char *) strchr(&text[startPos], ' ');
  strPos = endPos - text;
  if (strPos < startPos)
    return 0; // failure
  len = strPos - startPos;
  strncpy (buf, &text[startPos], len);
  buf[len] = '\0';
  Lng32 numRequests;
  scanCount = sscanf (buf, "%d", &numRequests);
  if (scanCount != 1)
    return 0;

  // Get each request
  if (numRequests > MAXNUMREQUESTS)
    return 0;
  for (Lng32 i = 0; i < numRequests; i++)
  {
    startPos = ++strPos;   
    CatApiRequest *request = new CatApiRequest();
    if (!request->convertTextToCatApiRequest(text, startPos))
      return 0;
    addRequest( request );
    strPos = startPos;
  }
  return 1;
}
Networking::Request *OneDriveStorage::createDirectory(Common::String path, BoolCallback callback, Networking::ErrorCallback errorCallback) {
	if (!errorCallback)
		errorCallback = getErrorPrintingCallback();
	return addRequest(new OneDriveCreateDirectoryRequest(this, path, callback, errorCallback));
}
Example #30
0
Networking::Request *GoogleDriveStorage::upload(Common::String path, Common::SeekableReadStream *contents, UploadCallback callback, Networking::ErrorCallback errorCallback) {
	return addRequest(new GoogleDriveUploadRequest(this, path, contents, callback, errorCallback));
}