int CMyAsyncHttp::HttpGetStatusCode(HINTERNET request,int &code) { CMyString str; code=0; if(HttpQueryInfo(request,str,HTTP_QUERY_STATUS_CODE)) { code=str.ToInt(); }; #ifdef _DEBUG int d=::GetLastError(); if(d==ERROR_HTTP_HEADER_NOT_FOUND) { LOG(TAG,"HttpGetStatusCode,can't find the header!"); } #endif return 1; }
bool CMailRecord::ParseDate(CMyString& value) { CMyString date; CMyString splitTxt; CMyString temp; CMyTimeInterval interval; int year=0,month=0,day=0,hour=0,minute=0,second=0; if(value.Match(DATE_REGEX,&date,true)!=-1) { int count=date.Split(" "); date.GetSplitString(1,splitTxt); day=splitTxt.ToInt(); date.GetSplitString(2,splitTxt); for(int i=1; i<=12; i++) { if(splitTxt.CompareI(CMyCalendar::sMonthS[i])) { month=i; break; } } date.GetSplitString(3,splitTxt); year=splitTxt.ToInt(); date.GetSplitString(4,splitTxt); splitTxt.Split(":"); splitTxt.GetSplitString(0,temp); hour=temp.ToInt(); splitTxt.GetSplitString(1,temp); minute=temp.ToInt(); splitTxt.GetSplitString(2,temp); second=temp.ToInt(); m_Time=CMyTime(year,month,day,hour,minute,second); if(count==6) { date.GetSplitString(5,splitTxt); char tempBuf[3]; tempBuf[2]=0; tempBuf[0]=splitTxt[1]; tempBuf[1]=splitTxt[2]; hour=atol(tempBuf); tempBuf[0]=splitTxt[3]; tempBuf[1]=splitTxt[4]; minute=atol(tempBuf); int totalSecond2=(hour*3600+minute*60)*(splitTxt[0]=='+'?1:-1); int totalSecond1=8*3600; int diff =totalSecond1-totalSecond2; if(diff<0) { interval.SetSingal(false); } else { diff=-diff; } interval.SetDays(diff/(3600*24)); diff%=3600*24; interval.SetHours(diff/3600); diff%=60; interval.SetMinutes(diff/60); m_Time+=interval; } return true; } return false; }