예제 #1
0
void
Feeder::HandleDeviceUpdate(BMessage *message)
{
	int32 opcode ;
	BVolume *volume = new BVolume ;
	dev_t device ;

	message->FindInt32("opcode", &opcode) ;

	switch (opcode) {
		case B_DEVICE_MOUNTED :
			message->FindInt32("new device", &device) ;
			volume->SetTo(device) ;
			AddQuery(volume) ;
			// Forward the message to Indexer so that it can spawn
			// a new thread for volume.
			be_app->PostMessage(message) ;
			break ;
		
		case B_DEVICE_UNMOUNTED :
			message->FindInt32("device", &device) ;
			volume->SetTo(device) ;
			RemoveQuery(volume) ;
			be_app->PostMessage(message) ;
			break ;
	}

	delete volume ;
}
예제 #2
0
	virtual bool AddUrlMapping(UrlMapping* pUrlMapping)
	{
		std::string queryStr = "insert into `" + dBParams.c_tableName + "` (`" + 
		dBParams.LongURLColumnName + "`,`" + dBParams.ShortURLColumnName + "`) VALUES('" + 
		pUrlMapping->GetLongUrl() + "','"  + pUrlMapping->GetShortUrl() + "')";
		
		return AddQuery(queryStr);
	}
예제 #3
0
void ActivenessComponent::SaveActivenessLog(CRoleActivenessLog::EActivenessAction eAction, int nTargetType, int nScore)
{
    CRoleActivenessLog *pLog = new CRoleActivenessLog();
    pLog->m_nRoleID = m_pRoleAttr->GetRoleID();
    pLog->m_eAction = eAction;
    pLog->m_nTarget = nTargetType;
    pLog->m_nScore = nScore;
    AddQuery(QUERY_LogRoleActiveness, m_pRoleAttr->GetRoleID(), pLog);
}
예제 #4
0
void CEntityCheckInComponent::_LogRoleCheckIn(unsigned int nRoleID, CRoleCheckInLog::ECheckInAction eCheckInAction, unsigned int nDayIndex, bool bIsVip, unsigned int nVipLevel)
{
    CRoleCheckInLog * pLog = new CRoleCheckInLog();
    pLog->m_nRoleID = nRoleID;
    pLog->m_eCheckInAction = eCheckInAction;
    pLog->m_nDayIndex = nDayIndex;
    pLog->m_bIsVip = bIsVip;
    pLog->m_nVipLevel = nVipLevel;
    AddQuery(QUERY_LogRoleCheckIn, 0, pLog);
}
예제 #5
0
void
Feeder::StartWatching()
{
	BVolume *volume = new BVolume ;
	
	while (fVolumeRoster.GetNextVolume(volume) != B_BAD_VALUE) {
		if ((volume->IsRemovable() && !fMonitorRemovableDevices)
			|| !volume->KnowsQuery())
				continue ;
		
		AddQuery(volume) ;
		volume = new BVolume ;
	}

	fVolumeRoster.StartWatching(this) ;
}
예제 #6
0
파일: HTTP.cpp 프로젝트: CodeAsm/open-sauce
		/*!
		 * \brief
		 * Splits a URL query string into individual field-value pairs.
		 * 
		 * \param query
		 * Pointer to the query string to parse.
		 * 
		 * Splits a URL query string into individual field-value pairs.
		 */
		void c_url_interface::ParseQuery(const char* query)
		{
			// field=value&field=&field=value

			// remove any existing queries
			ClearQueries();

			if(!query)
				return;

			std::string query_string(query);

			do
			{
				// split the query string at the next & if present to get the next query
				std::string current_query;
				SplitString(query_string, current_query, "&", true);

				if(current_query.length() == 0)
				{
					// this is the last query so set the string to whatever is left
					current_query = query_string;
					query_string.clear();
				}

				// check the string contains an "="
				if(std::string::npos == current_query.find("="))
				{
					// the query string is invalid, clear the query list and return
					ClearQueries();
					return;
				}

				std::string field;
				std::string value;
				// split at the "=" for the field and set the value to whatever is left
				SplitString(current_query, field, "=", true);

				field = Unescape(field, true);
				value = Unescape(current_query, true);

				AddQuery(field.c_str(), value.c_str());
			}while(query_string.length());
		}
예제 #7
0
void ActivenessComponent::SaveActivinessDataToDb()
{
    // 每次更新一整条数据到DB中
    RoleActivenessDB *pActivenessData = new RoleActivenessDB;

    // target_progress.
    ConcatToString(m_mapTargetProgress, std::string("|"), std::string(","), pActivenessData->m_strTargetProgress);
    ConcatToString(m_setFinishedDanceMode, std::string(","), pActivenessData->m_strDanceMode);

    // score.
    pActivenessData->m_nScore = m_nActivenessScore;
    pActivenessData->m_nUpdateTime = m_nUpdateTime;

    // reward statues.
    ConcatToString(m_setRewardLevelScore, "|", pActivenessData->m_strRewardLevelScore);

    AddQuery(QUERY_Activeness_UpdateOrInsert, m_pRoleAttr->GetRoleID(), pActivenessData);

    return;
}
예제 #8
0
void CEntityVIPComponent::VIPOnlineAnnounce()
{
    unsigned int nLastAnnounceTime = m_VIPInfo.m_nLastOnlineAnnounceTime;
    unsigned int nNow = (unsigned int)time(NULL);

    const CVIPLevelPrivInfo *pVIPPrivInfo = CVIPDataMgr::Instance().GetVIPPrivInfo(m_VIPInfo.m_nLevel);
    if (pVIPPrivInfo != NULL && pVIPPrivInfo->m_bOnlineAnnounce
        && nNow - nLastAnnounceTime >= (unsigned int)pVIPPrivInfo->m_nOnlineAnnounceCoolDown)
    {
        std::string strContent;
        SafeFormat(strContent, CLocalization::Instance().GetString("VIP_Online_Announce"),
            m_VIPInfo.m_nLevel, m_pRoleAttr->GetRoleName());

        CChatManager::Instance().SendAnnounce(true, false, strContent);// 红字公告
        //CChatManager::Instance().SendAnnounce(false, true, strContent);// 走马灯公告

        m_VIPInfo.m_nLastOnlineAnnounceTime = nNow;
        AddQuery(QUERY_VIP_UpdateOnlineAnnounceTime, m_pRoleAttr->m_nRoleID, NULL, nNow, NULL);
    }
}
예제 #9
0
void CEntityVIPComponent::LogRoleVip(ISQLLog *pLog)
{
    AddQuery(QUERY_LogRoleVip, 0, pLog);
}
예제 #10
0
void CEntityVIPComponent::UpdateVIPInfoToDB()
{
    CRoleVIPInfo *pVIPInfo = new CRoleVIPInfo(m_VIPInfo);
    CDelHelper delHelper(pVIPInfo);
    AddQuery(QUERY_SaveVIPInfo, GetRoleAttr()->GetRoleID(), pVIPInfo, 0, NULL, &delHelper);
}
예제 #11
0
void
LineoutListItem::Update(Subject *TheChangedSubject)
{
     if (origPlotQueryInfo == TheChangedSubject)
     {
         ViewerPlotList *vpl = resWin->GetPlotList();
         int i, nOps;
         switch(origPlotQueryInfo->GetChangeType())
         {
             case PlotQueryInfo::Database:
                 vpl->ReplaceDatabase(origPlot->GetEngineKey(),
                     origPlot->GetDatabaseName(), 0, false, false,false);
                 break;
             case PlotQueryInfo::VarName:
                 vpl->SetPlotVar(origPlot->GetVariableName());
                 break;
             case PlotQueryInfo::OpAtts:
                 nOps = origPlot->GetNOperators();
                 for (i = 0; i < nOps; i++)
                 {
                     vpl->SetPlotOperatorAtts(origPlot->GetOperator(i)->GetType());
                 }
                 break;
             case PlotQueryInfo::CacheIndex:
                 if (ViewerQueryManager::Instance()->GetGlobalLineoutAtts()->
                     GetCurveOption() == GlobalLineoutAttributes::CreateCurve)
                 {
                     int newf = origPlotQueryInfo->GetNewFrameIndex();
                     int oldf = origPlotQueryInfo->GetOldFrameIndex();
                     std::vector<ViewerQuery_p> addme;
                     for (i = 0; i < nQueries; i++)
                     {
                         if (queries[i]->MatchTimeState(oldf))
                         {
                             ViewerQuery_p nq = new ViewerQuery(*queries[i], newf);
                             addme.push_back(nq);
                         }
                     }
                     for (i = 0; i < (int)addme.size(); i++)
                     {
                         AddQuery(addme[i]);
                     }
                 }
                 else
                 {
                     int newf = origPlotQueryInfo->GetNewFrameIndex();
                     vpl->SetActiveTimeSlider(origWin->GetPlotList()->
                                              GetActiveTimeSlider());
                     vpl->SetTimeSliderState(newf);
                 }
                 break;
             case PlotQueryInfo::AddOp:          // fall through
             case PlotQueryInfo::MoveOperator:   // fall through
             case PlotQueryInfo::RemoveOperator: // fall through
             case PlotQueryInfo::RemoveAll:      // fall through
             case PlotQueryInfo::RemoveLast:
                 for (i = 0; i < nQueries; i++)
                 {
                     queries[i]->ReCreateLineout(); 
                 }
                 break;
             default:
                 // do nothing
                 break;

        }  // switch
    } // if
}
예제 #12
0
void CEntityCheckInComponent::SaveCheckInInfoToDB()
{
    CCheckInInfo * pCheckInInfo = new CCheckInInfo(m_CheckInInfo);
    CDelHelper delHelper(pCheckInInfo);
    AddQuery(QUERY_UpdateCheckInInfo, m_pRoleAttr->GetRoleID(), pCheckInInfo, 0, NULL, &delHelper);
}