STDMETHODIMP CBHttpRequest::Open(BSTR strMethod, BSTR strUrl, VARIANT_BOOL bAsync, VARIANT varUser, VARIANT varPassword) { CUrl url; CStringA strObject; CStringA strUser; CStringA strPassword; Abort(); s_cs.Enter(); s_dwReqID ++; m_dwReqID = s_dwReqID; s_mapReq.SetAt(m_dwReqID, this); s_cs.Leave(); url.CrackUrl(CBStringA(strUrl)); m_bAsync = (bAsync != VARIANT_FALSE); strObject = url.GetUrlPath(); strObject.Append(url.GetExtraInfo()); if(varUser.vt != VT_ERROR) { HRESULT hr = varGetString(varUser, strUser); if(FAILED(hr))return hr; } if(varPassword.vt != VT_ERROR) { HRESULT hr = varGetString(varPassword, strPassword); if(FAILED(hr))return hr; } m_hConnection = InternetConnect(m_hSession, url.GetHostName(), url.GetPortNumber(), strUser.IsEmpty() ? NULL : (LPCSTR)strUser, strPassword.IsEmpty() ? NULL : (LPCSTR)strPassword, INTERNET_SERVICE_HTTP, 0, m_dwReqID); if(m_hConnection == NULL) return GetErrorResult(); m_hFile = HttpOpenRequest(m_hConnection, CBStringA(strMethod), strObject, NULL, NULL, NULL, m_dwFlags, m_dwReqID); if(m_hFile == NULL) return GetErrorResult(); m_eventComplete.Set(); return S_OK; }
//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 }
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(); }