bool CMsnContactManager::GetMessage(const CMsnTicket& ticket) { acl::http_client client; acl::string addr(MSN_CONTACT_SERVER); // 连接 MSN SSO 服务器(ssl 方式) addr << ":443"; if (client.open(addr.c_str()) == false) return (false); // 获得联系人列表 if (GetContacts(ticket, client) == false) return (false); // 关闭连接 client.get_stream().close(); // 再次打开连接 addr << ":443"; if (client.open(addr.c_str(), true) == false) return (false); // 获得地址薄列表 if (GetAddresses(ticket, client) == false) return (false); // 创建用户列表 CreateUsers(); return (true); }
const std::vector<GameObjectContact>& RuntimeGameObject::GetContacts() const { static std::vector<GameObjectContact> emptyContacts; auto body = _body.lock(); if (body) { return body->GetContacts(); } return emptyContacts; }
// call this to generate contacts using the partitioned space void HydraOctree::GetContacts(DragonContactGenerator& contactGen, HydraOctree* pNode) { if (pNode==NULL) { return; } if (pNode->m_bIsNode) { contactGen.GenerateContacts(pNode->m_vEntities); } else { GetContacts(contactGen,pNode->m_pHydraNodes[Top_Front_Left]); GetContacts(contactGen,pNode->m_pHydraNodes[Top_Front_Right]); GetContacts(contactGen,pNode->m_pHydraNodes[Top_Back_Left]); GetContacts(contactGen,pNode->m_pHydraNodes[Top_Back_Right]); GetContacts(contactGen,pNode->m_pHydraNodes[Bottom_Front_Left]); GetContacts(contactGen,pNode->m_pHydraNodes[Bottom_Front_Right]); GetContacts(contactGen,pNode->m_pHydraNodes[Bottom_Back_Left]); GetContacts(contactGen,pNode->m_pHydraNodes[Bottom_Back_Right]); } }
LPMAPIFOLDER CExMapi::GetContacts(LPMAPIFOLDER pFolder,LONG& folderCount,LONG& contactCount,LONG& skipCount,LONG& contactIndex,CObArray& contactArray,BOOL doLog) { __recursionCount++; wchar_t buffer[5]; _itow(__recursionCount,buffer,10); if(doLog) { if(__recursionCount > 1) m_logHelper.LogPAB(L"-------------------------------------"); m_logHelper.LogPAB(L"Recursive Call No: "+CString(buffer)); m_logHelper.LogPAB(L"-------------------------------------"); } CString strFilterBy = m_pCtrl->GetPABSerachBy(); CString strStartWith = m_pCtrl->GetPABSerachStartWith(); strStartWith = strStartWith.MakeLower(); ULONG pageSize; m_pCtrl->get_PABPageSize(&pageSize); LONG pageNumber = m_pCtrl->GetPABPageNumber(); LONG startIndex = -1; if(pageSize>0) { startIndex = (pageSize * pageNumber) - pageSize; } LPMAPIFOLDER pSubFolder=NULL; LPMAPITABLE pHierarchy; CString strFolder; try { if(doLog) m_logHelper.LogPAB(L"RELEASE(m_pHierarchy); START"); RELEASE(m_pHierarchy); if(doLog) m_logHelper.LogPAB(L"RELEASE(m_pHierarchy); END"); if(doLog) m_logHelper.LogPAB(L"pHierarchy = GetHierarchy(pFolder); START"); pHierarchy = GetHierarchy(pFolder); if(doLog) m_logHelper.LogPAB(L"pHierarchy = GetHierarchy(pFolder); END"); if(pHierarchy) { LPMAPIFOLDER pRecurse = NULL; do { RELEASE(pSubFolder); m_pHierarchy = pHierarchy; if(doLog) m_logHelper.LogPAB(L"pSubFolder = GetNextSubFolder(strFolder,pFolder); START"); pSubFolder = GetNextSubFolder(strFolder,pFolder); if(doLog) m_logHelper.LogPAB(L"pSubFolder = GetNextSubFolder(strFolder,pFolder); END"); if(pSubFolder) { //if(strFolder == L"Deleted Items") // continue; if(IsContactFolder(pSubFolder)) { folderCount++; if(doLog) m_logHelper.LogPAB(L"if(GetContents(pSubFolder)) START"); if(GetContents(pSubFolder)) { if(doLog) m_logHelper.LogPAB(L"if(GetContents(pSubFolder)) END"); SortContents(TABLE_SORT_ASCEND,PR_DISPLAY_NAME); //SortContents(TABLE_SORT_ASCEND,PR_SUBJECT); CString strText; CExMapiContact mapiContact; CString name; CString email; BOOL mustFilter = FALSE; mustFilter = strStartWith != ""; if(doLog) m_logHelper.LogPAB(L"Start Reading Contact properties"); while(GetNextContact(mapiContact) && !m_pCtrl->IsPABSearchAbort()) { if(pageSize > 0) { if(contactCount == pageSize) { break; } } contactIndex++; if(mustFilter) { if(strFilterBy == "Name") { mapiContact.GetName(name,PR_GIVEN_NAME); name = name.MakeLower(); if(name.Find(strStartWith) != 0) { continue; } } if(strFilterBy == "Email") { mapiContact.GetEmail(email); email = email.MakeLower(); if(email.Find(strStartWith) != 0) { continue; } } } if(startIndex > 0 && skipCount < startIndex) { skipCount++; continue; } CContact* pContact = new CContact(); pContact->SetId(contactIndex); pContact->SetFolderName(strFolder); mapiContact.GetName(strText); pContact->SetFullName(strText); mapiContact.GetCompany(strText); pContact->SetCompany(strText); mapiContact.GetIMAddress(strText); pContact->SetIMAddress(strText); mapiContact.GetName(strText,PR_GIVEN_NAME); pContact->SetFirstName(strText); mapiContact.GetName(strText,PR_MIDDLE_NAME); pContact->SetMiddleName(strText); mapiContact.GetName(strText,PR_SURNAME); pContact->SetLastName(strText); mapiContact.GetEmail(strText); pContact->SetEmail(strText); mapiContact.GetEmail(strText,2);//Email 2 pContact->SetEmail2(strText); mapiContact.GetEmail(strText,3);//Email 3 pContact->SetEmail3(strText); mapiContact.GetPhoneNumber(strText,PR_BUSINESS_TELEPHONE_NUMBER); pContact->SetBusinessPhone(strText); mapiContact.GetPhoneNumber(strText,PR_COMPANY_MAIN_PHONE_NUMBER); pContact->SetCompanyPhone(strText); mapiContact.GetPhoneNumber(strText,PR_BUSINESS_FAX_NUMBER); pContact->SetFax(strText); mapiContact.GetPhoneNumber(strText,PR_MOBILE_TELEPHONE_NUMBER); pContact->SetMobilePhone(strText); mapiContact.GetPhoneNumber(strText,PR_HOME_TELEPHONE_NUMBER); pContact->SetHomePhone(strText); if(m_pCtrl->FetchUnique()) { BOOL isContactExist = FALSE; for(int i=0;i<contactArray.GetCount();i++) { CContact* pTemp = (CContact*)contactArray.GetAt(i); if(pContact->GetEmail() != "" && pTemp->GetEmail() == pContact->GetEmail()) { isContactExist = TRUE; break; } else if(pContact->GetFullName() != "" && pTemp->GetFullName() == pContact->GetFullName()) { isContactExist = TRUE; break; } else if(pContact->GetMobilePhone() != "" && pTemp->GetMobilePhone() == pContact->GetMobilePhone()) { isContactExist = TRUE; break; } else if(pContact->GetHomePhone() != "" && pTemp->GetHomePhone() == pContact->GetHomePhone()) { isContactExist = TRUE; break; } else if(pContact->GetBusinessPhone() != "" && pTemp->GetBusinessPhone() == pContact->GetBusinessPhone()) { isContactExist = TRUE; break; } } if(isContactExist) { continue; } } contactArray.Add(pContact); contactCount++; } } } m_pHierarchy = NULL; // so we don't release it in subsequent drilldown if(pageSize > 0) { if(contactCount == pageSize) break; } if(__recursionCount < m_pCtrl->GetSubFOlderLevel()) { pRecurse = GetContacts(pSubFolder,folderCount,contactCount,skipCount,contactIndex,contactArray,doLog); } if(pRecurse) { RELEASE(pSubFolder); pSubFolder = pRecurse; break; } } else { __recursionCount = 1; } if(pageSize > 0) { if(contactCount == pageSize) break; } } while(pSubFolder && !m_pCtrl->IsPABSearchAbort()); RELEASE(pHierarchy); m_pHierarchy=NULL; } // this may occur many times depending on how deep the recursion is; make sure we haven't already assigned m_pFolder if(pSubFolder && m_pFolder!=pSubFolder) { RELEASE(m_pFolder); m_pFolder=pSubFolder; } } catch(_com_error &e) { if(doLog) { m_logHelper.LogPAB(L"GetContactFolderCount Exception Catch START:"); m_logHelper.LogPAB(L"FolderName: " + strFolder ); m_logHelper.LogPAB(e.ErrorMessage()); m_logHelper.LogPAB(L"GetContactFolderCount Exception Catch END:"); } } return pSubFolder; }
BOOL CExMapi::GetContacts(CObArray& contactArray,CTRError& error) { BOOL doLog = m_pCtrl->IsEnableLog(); if(doLog) { m_logHelper.LogPAB(L"------------------------------------"); m_logHelper.LogPAB(L"Function GetPABCotacts START:"); m_logHelper.LogPAB(L"------------------------------------"); } CString strFilterBy = m_pCtrl->GetPABSerachBy(); CString strStartWith = m_pCtrl->GetPABSerachStartWith(); strStartWith = strStartWith.MakeLower(); ULONG pageSize; m_pCtrl->get_PABPageSize(&pageSize); ULONG pageNumber = m_pCtrl->GetPABPageNumber(); LONG contactCount = 0; LONG skipCount = 0; LONG startIndex = -1; LONG contactIndex = 0; LONG folderCount = 0; if(pageSize>0) { startIndex = (pageSize * pageNumber) - pageSize; } CString strFolder; int msgStoreCount = 0; wchar_t buffer[5]; LPMAPIFOLDER pSubFolder=NULL; LPMAPITABLE lpMsgStoreTable = NULL; lpMsgStoreTable = GetMessageStoresTable(); if(lpMsgStoreTable) { while(OpenNextMessageStore(lpMsgStoreTable)) { //GetContacts(OpenRootFolder(),folderCount,contactCount,skipCount,contactIndex,contactArray); msgStoreCount++; _itow(msgStoreCount,buffer,10); if(doLog) { if(msgStoreCount > 1) m_logHelper.LogPAB(L"-------------------------------------"); m_logHelper.LogPAB(L"Message Store No : "+CString(buffer)); m_logHelper.LogPAB(L"-------------------------------------"); } pSubFolder = OpenContacts(); if(pSubFolder && IsContactFolder(pSubFolder)) { if(doLog) m_logHelper.LogPAB(L"Open Main Contacts Folder"); strFolder = GetFolderName(pSubFolder); folderCount++; if(GetContents(pSubFolder)) { SortContents(TABLE_SORT_ASCEND,PR_DISPLAY_NAME); //SortContents(TABLE_SORT_ASCEND,PR_SUBJECT); CString strText; CExMapiContact mapiContact; CString name; CString email; BOOL mustFilter = FALSE; mustFilter = strStartWith != ""; if(doLog) m_logHelper.LogPAB(L"Start reading contacts from main contact fodler"); while(GetNextContact(mapiContact) && !m_pCtrl->IsPABSearchAbort()) { if(pageSize > 0) { if(contactCount == pageSize) { break; } } contactIndex++; if(mustFilter) { if(strFilterBy == "Name") { mapiContact.GetName(name,PR_GIVEN_NAME); name = name.MakeLower(); if(name.Find(strStartWith) != 0) { continue; } } if(strFilterBy == "Email") { mapiContact.GetEmail(email); email = email.MakeLower(); if(email.Find(strStartWith) != 0) { continue; } } } if(startIndex > 0 && skipCount < startIndex) { skipCount++; continue; } CContact* pContact = new CContact(); pContact->SetId(contactIndex); pContact->SetFolderName(strFolder); mapiContact.GetName(strText); pContact->SetFullName(strText); mapiContact.GetCompany(strText); pContact->SetCompany(strText); mapiContact.GetIMAddress(strText); pContact->SetIMAddress(strText); mapiContact.GetName(strText,PR_GIVEN_NAME); pContact->SetFirstName(strText); mapiContact.GetName(strText,PR_MIDDLE_NAME); pContact->SetMiddleName(strText); mapiContact.GetName(strText,PR_SURNAME); pContact->SetLastName(strText); mapiContact.GetEmail(strText); pContact->SetEmail(strText); mapiContact.GetEmail(strText,2);//Email 2 pContact->SetEmail2(strText); mapiContact.GetEmail(strText,3);//Email 3 pContact->SetEmail3(strText); mapiContact.GetPhoneNumber(strText,PR_BUSINESS_TELEPHONE_NUMBER); pContact->SetBusinessPhone(strText); mapiContact.GetPhoneNumber(strText,PR_COMPANY_MAIN_PHONE_NUMBER); pContact->SetCompanyPhone(strText); mapiContact.GetPhoneNumber(strText,PR_BUSINESS_FAX_NUMBER); pContact->SetFax(strText); mapiContact.GetPhoneNumber(strText,PR_MOBILE_TELEPHONE_NUMBER); pContact->SetMobilePhone(strText); mapiContact.GetPhoneNumber(strText,PR_HOME_TELEPHONE_NUMBER); pContact->SetHomePhone(strText); if(m_pCtrl->FetchUnique()) { BOOL isContactExist = FALSE; for(int i=0;i<contactArray.GetCount();i++) { CContact* pTemp = (CContact*)contactArray.GetAt(i); if(pContact->GetEmail() != "" && pTemp->GetEmail() == pContact->GetEmail()) { isContactExist = TRUE; break; } else if(pContact->GetFullName() != "" && pTemp->GetFullName() == pContact->GetFullName()) { isContactExist = TRUE; break; } else if(pContact->GetMobilePhone() != "" && pTemp->GetMobilePhone() == pContact->GetMobilePhone()) { isContactExist = TRUE; break; } else if(pContact->GetHomePhone() != "" && pTemp->GetHomePhone() == pContact->GetHomePhone()) { isContactExist = TRUE; break; } else if(pContact->GetBusinessPhone() != "" && pTemp->GetBusinessPhone() == pContact->GetBusinessPhone()) { isContactExist = TRUE; break; } } if(isContactExist) { continue; } } contactArray.Add(pContact); contactCount++; } } if(doLog) m_logHelper.LogPAB(L"Open Sub Contacts Folder"); GetContacts(pSubFolder,folderCount,contactCount,skipCount,contactIndex,contactArray,doLog); } if(pageSize > 0) { if(contactCount == pageSize) break; } if(m_pCtrl->IsPABSearchAbort()) break; __recursionCount = 0; } } if(doLog) { m_logHelper.LogPAB(L"------------------------------------"); m_logHelper.LogPAB(L"Function GetPABCotacts END:"); m_logHelper.LogPAB(L"------------------------------------"); m_logHelper.ClosePABLog(); } __recursionCount = 0; RELEASE(lpMsgStoreTable); if(folderCount == 0 && !m_pCtrl->IsPABSearchAbort()) { error.code = 107; error.err = "TRContactFinder Cannot find private folders."; return FALSE; } return TRUE; }
void AABBTreeLeaf::GetContacts(AABBTreeLeaf* leaf, Contact** iterator) { if(leaves[LEFT].IsEmpty()) { //leaf = leaf->GetLeaf(box); unsigned size = GetSize(); for(AABBTreeNode* node = begin; node != begin + size; ++node) { leaf->GetContacts(node, iterator); } //if(leaf->leaves[LEFT].IsEmpty()) //{ // const unsigned size = GetSize(); // const AABBTreeNode* end = begin + size; // for(AABBTreeNode* node = begin; node != end; ++node) // { // unsigned theirSize = leaf->GetSize(); // AABBTreeNode* theirEnd = leaf->begin + theirSize; // for(AABBTreeNode* theirNode = leaf->begin; theirNode != theirEnd; ++theirNode) // { // if(node->box.IsOverlapping(theirNode->box)) // { // (*iterator)->node1 = node; // (*iterator)->node2 = theirNode; // ++(*iterator); // } // } // } //} //else //{ // leaf->leaves[LEFT].GetContacts(this, iterator); // leaf->leaves[RIGHT].GetContacts(this, iterator); //} return; } //else if(leaf->leaves[LEFT].IsEmpty()) //{ // unsigned size = leaf->GetSize(); // for(AABBTreeNode* node = leaf->begin; node != leaf->begin + size; ++node) // { // GetContacts(node, iterator); // } // return; //} //if(leaves[LEFT].box.IsOverlapping(leaf->leaves[LEFT].box)) //{ // leaves[LEFT].GetContacts(&leaf->leaves[LEFT], iterator); //} //if(leaves[LEFT].box.IsOverlapping(leaf->leaves[RIGHT].box)) //{ // leaves[LEFT].GetContacts(&leaf->leaves[RIGHT], iterator); //} //if(leaves[RIGHT].box.IsOverlapping(leaf->leaves[LEFT].box)) //{ // leaves[RIGHT].GetContacts(&leaf->leaves[LEFT], iterator); //} //if(leaves[RIGHT].box.IsOverlapping(leaf->leaves[RIGHT].box)) //{ // leaves[RIGHT].GetContacts(&leaf->leaves[RIGHT], iterator); //} bool hitsLeft = leaf->leaves[LEFT].box.IsOverlapping(box); bool hitsRight = leaf->leaves[RIGHT].box.IsOverlapping(box); if((hitsLeft && hitsRight) || leaf->leaves[LEFT].IsEmpty()) { if(leaves[LEFT].box.IsOverlapping(leaf->box)) { leaves[LEFT].GetContacts(leaf, iterator); } if(leaves[RIGHT].box.IsOverlapping(leaf->box)) { leaves[RIGHT].GetContacts(leaf, iterator); } } else { if(hitsLeft) { GetContacts(&leaf->leaves[LEFT], iterator); } else if(hitsRight) { GetContacts(&leaf->leaves[RIGHT], iterator); } } }