예제 #1
0
void CALLBACK CBHttpRequest::staticStatusCallback(HINTERNET hInternet, DWORD ReqID, DWORD dwInternetStatus, LPVOID lpvStatusInformation, DWORD dwStatusInformationLength)
{
    CBHttpRequest* pHttp = NULL;

    s_cs.Enter();
    s_mapReq.Lookup(ReqID, pHttp);
    s_cs.Leave();

    if(pHttp)pHttp->StatusCallback(dwInternetStatus);
}
예제 #2
0
CBBrowserCaps::CBBrowserCaps(LPCSTR pstrUserAgent) : m_strUserAgent(pstrUserAgent)
{
	Init();

	if(s_bcDatas.Lookup(m_strUserAgent, m_pData))
		return;

	size_t i;

	for(i = 0; i < s_bcDatasExt.GetCount(); i ++)
		if (MatchString((LPCSTR)s_bcDatasExt[i]->UserAgent, pstrUserAgent))
		{
			m_pData = s_bcDatasExt[i];
			break;
		}
}
예제 #3
0
//MOPRH START - Added by SiRoB, Slugfiller: modid
void CClientList::GetModStatistics(CRBMap<uint32, CRBMap<CString, uint32>* > *clientMods){
	if (!clientMods)
		return;
	clientMods->RemoveAll();
	
	// [TPT] Code improvement
	for (POSITION pos = list.GetHeadPosition(); pos != NULL;) {		
		CUpDownClient* cur_client =	list.GetNext(pos);

		switch (cur_client->GetClientSoft()) {
		case SO_EMULE   :
		case SO_OLDEMULE:
			break;
		default:
			continue;
		}

		CRBMap<CString, uint32> *versionMods;

		if (!clientMods->Lookup(cur_client->GetVersion(), versionMods)){
			versionMods = new CRBMap<CString, uint32>;
			versionMods->RemoveAll();
			clientMods->SetAt(cur_client->GetVersion(), versionMods);
		}

		uint32 count;

		if (!versionMods->Lookup(cur_client->GetClientModVer(), count))
			count = 1;
		else
			count++;

		versionMods->SetAt(cur_client->GetClientModVer(), count);
	}
	// [TPT] end
}
예제 #4
0
void CBBrowserCaps::Init(void)
{
	if(s_bInited)return;

	s_csBrowserCaps.Enter();
	if(s_bInited)
	{
		s_csBrowserCaps.Leave();
		return;
	}

	CBComPtr<_Data> pData;
	int n;
	BOOL bFind = FALSE;

	pData.CreateInstance();

	CBComPtr<CBFile> pFile;
	CBStringA strLine;

	pFile.CreateInstance();
	if(SUCCEEDED(pFile->Open(L"\\browscap.ini")))
	{
		while(SUCCEEDED(pFile->ReadLine(strLine)))
		{
			strLine.Trim();
			if(!strLine.IsEmpty())
				if(strLine[0] == '[' && strLine[strLine.GetLength() - 1] == ']')
				{
					pData.CreateInstance();
					pData->UserAgent = strLine.Mid(1, strLine.GetLength() - 2);

					if(pData->UserAgent.Find('*') == -1 && pData->UserAgent.Find('?') == -1)
						s_bcDatas.SetAt(pData->UserAgent, pData);
					else s_bcDatasExt.Add(pData);

					if(!pData->UserAgent.Compare("*"))
						bFind = TRUE;
				}else if(strLine[0] != ';')
				{
					n = strLine.Find('=');
					if(n != -1)
					{
						CBStringA strName, strValue;

						strName = strLine.Left(n).Trim();
						if(!strName.IsEmpty())
						{
							strValue = strLine.Mid(n + 1).Trim();
							if(!strName.CompareNoCase("parent"))
							{
								CBComPtr<_Data> pParentData;
								
								if(s_bcDatas.Lookup(strValue, pParentData))
								{
									pData->Name = pParentData->Name;
									pData->Type = pParentData->Type;
									pData->Version = pParentData->Version;
									pData->MajorVersion = pParentData->MajorVersion;
									pData->MinorVersion = pParentData->MinorVersion;
									pData->Platform = pParentData->Platform;
									pData->CSSVersion = pParentData->CSSVersion;
									pData->Frames = pParentData->Frames;
									pData->IFrames = pParentData->IFrames;
									pData->Tables = pParentData->Tables;
									pData->Cookies = pParentData->Cookies;
									pData->BackgroundSounds = pParentData->BackgroundSounds;
									pData->VBScript = pParentData->VBScript;
									pData->JavaScript = pParentData->JavaScript;
									pData->JavaApplets = pParentData->JavaApplets;
									pData->ActiveXControls = pParentData->ActiveXControls;
									pData->CDF = pParentData->CDF;
									pData->AOL = pParentData->AOL;
									pData->Beta = pParentData->Beta;
									pData->Win16 = pParentData->Win16;
									pData->Crawler = pParentData->Crawler;
									pData->WAP = pParentData->WAP;
									pData->NetCLR = pParentData->NetCLR;
								}
							}
							else if(!strName.CompareNoCase("browser"))
							{
								pData->Name = strValue;

								pData->Type = pData->Name;
								if(!pData->MajorVersion.IsEmpty() && pData->MajorVersion.Compare(L"0"))
								{
									pData->Type += ' ';
									pData->Type += pData->MajorVersion;
								}
							}
							else if(!strName.CompareNoCase("Version"))
								pData->Version = strValue;
							else if(!strName.CompareNoCase("MajorVer"))
							{
								pData->MajorVersion = strValue;

								pData->Type = pData->Name;
								if(!pData->MajorVersion.IsEmpty() && pData->MajorVersion.Compare(L"0"))
								{
									pData->Type += ' ';
									pData->Type += pData->MajorVersion;
								}
							}
							else if(!strName.CompareNoCase("MinorVer"))
								pData->MinorVersion = strValue;
							else if(!strName.CompareNoCase("Platform"))
								pData->Platform = strValue;
							else if(!strName.CompareNoCase("CSS"))
								pData->CSSVersion = atoi(strValue);
							else if(!strName.CompareNoCase("Frames"))
								pData->Frames = !strValue.CompareNoCase("true");
							else if(!strName.CompareNoCase("IFrames"))
								pData->IFrames = !strValue.CompareNoCase("true");
							else if(!strName.CompareNoCase("Tables"))
								pData->Tables = !strValue.CompareNoCase("true");
							else if(!strName.CompareNoCase("Cookies"))
								pData->Cookies = !strValue.CompareNoCase("true");
							else if(!strName.CompareNoCase("BackgroundSounds"))
								pData->BackgroundSounds = !strValue.CompareNoCase("true");
							else if(!strName.CompareNoCase("VBScript"))
								pData->VBScript = !strValue.CompareNoCase("true");
							else if(!strName.CompareNoCase("JavaScript"))
								pData->JavaScript = !strValue.CompareNoCase("true");
							else if(!strName.CompareNoCase("JavaApplets"))
								pData->JavaApplets = !strValue.CompareNoCase("true");
							else if(!strName.CompareNoCase("ActiveXControls"))
								pData->ActiveXControls = !strValue.CompareNoCase("true");
							else if(!strName.CompareNoCase("CDF"))
								pData->CDF = !strValue.CompareNoCase("true");
							else if(!strName.CompareNoCase("AOL"))
								pData->AOL = !strValue.CompareNoCase("true");
							else if(!strName.CompareNoCase("Beta"))
								pData->Beta = !strValue.CompareNoCase("true");
							else if(!strName.CompareNoCase("Win16"))
								pData->Win16 = !strValue.CompareNoCase("true");
							else if(!strName.CompareNoCase("Crawler"))
								pData->Crawler = !strValue.CompareNoCase("true");
							else if(!strName.CompareNoCase("WAP"))
								pData->WAP = !strValue.CompareNoCase("true");
							else if(!strName.CompareNoCase("NetCLR"))
								pData->NetCLR = !strValue.CompareNoCase("true");
						}
					}
				}
		}
	}

	if(!bFind)
	{
		pData.CreateInstance();
		pData->UserAgent = "*";
		s_bcDatasExt.Add(pData);
	}

	qsort(s_bcDatasExt.GetData(), s_bcDatasExt.GetCount(), sizeof(CBComPtr<_Data>),
		(int (__cdecl *)(const void *,const void *))staticCompare);

	s_bInited = TRUE;
	s_csBrowserCaps.Leave();
}