コード例 #1
0
void SearchController::requestMore(
		const SparseIdsSliceBuilder::AroundData &key,
		const Query &query,
		Data *listData) {
	if (listData->requests.contains(key)) {
		return;
	}
	auto requestId = request(PrepareSearchRequest(
		listData->peer,
		query.type,
		query.query,
		key.aroundId,
		key.direction)
	).done([=](const MTPmessages_Messages &result) {
		listData->requests.remove(key);
		auto parsed = ParseSearchResult(
			listData->peer,
			query.type,
			key.aroundId,
			key.direction,
			result);
		listData->list.addSlice(
			std::move(parsed.messageIds),
			parsed.noSkipRange,
			parsed.fullCount);
	}).send();
	listData->requests.emplace(key, [=] {
		request(requestId).cancel();
	});
}
コード例 #2
0
void CAreaSearchResult::ConstructL(const TDesC& aDes) 
    {
    TLex line(aDes);
    line.Mark();
    TInt redefined=0;

    if (line.Peek() != '#' && line.Peek() != '\t')
        { 
        TInt index=0;
        while (line.Peek() != '\n' && !(line.Peek()).Eos())
            {
            line.Inc();
            if (line.Peek() == '\t')
                {
                TPtrC token = line.MarkedToken();
                TLex val(token);              
                switch(index)
                    {
                    case ESouthLat:
                        val.Val(iSouthLat, TChar(','));   
                        break;
                    case ENorthLat:
                        val.Val(iNorthLat, TChar(','));   
                        break;
                    case EWestLong:
                        val.Val(iWestLong, TChar(','));   
                        break;
                    case EEastLong:
                        val.Val(iEastLong, TChar(','));   
                        break;
                    case EErrorCode:
                        val.Val(iErrorCode);   
                        break;
                    case ESearchResult:
                        ParseSearchResult(token);
                        break;
                    case ERedefined:
                        val.Val(redefined);
                        if (redefined == 1)
                            {
                            iRedefined = ETrue;
                            }
                        break;
                    }    
                line.Inc();
                while (line.Peek() == '\t') // Empty value
                    {
                    line.Inc();
                    ++index;
                    }
                line.Mark();
                ++index;
                }
            }
        }
    
    }
/**
 * Called by the SteamAPI when a server has successfully responded
 */
void FOnlineAsyncTaskSteamFindServerBase::ServerResponded(HServerListRequest Request, int iServer)
{
	ElapsedTime = 0.0f;

	gameserveritem_t* Server = SteamMatchmakingServersPtr->GetServerDetails(Request, iServer);
	if (Server != NULL)
	{
		// Filter out servers that don't match our appid here
		if (!Server->m_bDoNotRefresh && Server->m_nAppID == SteamUtils()->GetAppID())
		{
			ParseSearchResult(Server);
		}
	}
}
コード例 #4
0
void CCategorySearchResult::ConstructL(const TDesC& aDes) 
    {
    TLex line(aDes);
    line.Mark();
    TInt redefined=0;

    if (line.Peek() != '#' && line.Peek() != '\t')
        { 
        TInt index=0;
        while (line.Peek() != '\n' && !(line.Peek()).Eos())
            {
            line.Inc();
            if (line.Peek() == '\t')
                {
                TPtrC token = line.MarkedToken();
                TLex val(token);              
                switch(index)
                    {
                    case ETextCriteria:
                        iTextCriteria = token.AllocL();
                        break;
                    case ELmSearchResult:
                        ParseSearchResult(token);
                        break;
                    case ERedefined:
                        val.Val(redefined);
                        if (redefined == 1)
                            {
                            iRedefined = ETrue;
                            }
                        break;
                    }    
                line.Inc();
                while (line.Peek() == '\t') // Empty value
                    {
                    line.Inc();
                    ++index;
                    }
                line.Mark();
                ++index;
                }
            }  
        }
    }