ETagDB *ETagDBPtr = ETagTmrPtr->GetPointer(AccountDir);
+ CardDAV2 *ConnObject = new CardDAV2(AccountAddress.ToStdString(), AccountPort, AccountUsername.ToStdString(), AccountPassword.ToStdString(), AccountSSL, AccountPrefix.ToStdString(), AccountDir.ToStdString());
+ ConnObject->SetupConnectionObject();
+
ActivityList.insert(std::make_pair(ActivityTaskID, 0));
ActivityListType.insert(std::make_pair(ActivityTaskID, 2));
ActivityListData.insert(std::make_pair(ActivityTaskID, TaskData));
+ ActivityListURL.insert(std::make_pair(ActivityTaskID, TaskURL));
ActivityListAccount.insert(std::make_pair(ActivityTaskID, TaskAccount));
ActivityListFilename.insert(std::make_pair(ActivityTaskID, TaskFilename));
+ ActivityListConnObject.insert(std::make_pair(ActivityTaskID, ConnObject));
ActivityListIndex.insert(std::make_pair(ActivityTaskID, itemindex));
ActivityListAccSettings.insert(std::make_pair(ActivityTaskID, AccountSettings));
break;
}
- ETagDBPtr->AddETag(ContactFilename, ETagGetResponse.EntityTag, ETagGetResponse.EntityTag);
+ std::cout << ETagGetResponse.EntityTag << std::endl;
+
+ ETagDBPtr->UpdateETag(ContactFilename, ETagGetResponse.EntityTag, ETagGetResponse.EntityTag);
iter->second = 4;
break;
// Compare the ETag with the Server ETag.
- std::cout << ETagOriginal << std::endl;
- std::cout << ETagServer << std::endl;
-
if (ETagOriginal != ETagServer){
// Server ETag is different from original ETag.
break;
}
- std::cout << "Etag Update!" << std::endl;
- std::cout << ETagGetResponse.EntityTag << std::endl;
-
ETagDBPtr->UpdateETag(ContactFilename, ETagGetResponse.EntityTag, ETagGetResponse.EntityTag);
iter->second = 4;
while(KeepUpdating == TRUE){
+ COConnectResult ConnectResponse = ConnObjectIter->second->Connect(false);
+
bool ExitLoop = FALSE;
while (ExitLoop == FALSE){
- int ErrorCode = ConnHandle.SSLVerifyTest();
+ if (ConnObjectIter->second->SSLVerify() == COSSL_UNABLETOVERIFY){
+
+ frmMainPtrGet->PauseAllTimers();
+
+#if defined(__APPLE__)
+#elif defined(__WIN32__)
+#else
+
+ bool UsingSSLBypass = false;
+ int SSLResult = 0;
+
+ // Connect again and fetch SSL certificate information.
+
+ ConnObjectIter->second->BypassSSLVerification(true);
+
+ COConnectResult ConnectionSSLResult = ConnObjectIter->second->Connect(false);
+
+ ConnObjectIter->second->BypassSSLVerification(false);
+
+ SSLInvalidCertNotifObjString SSLICNProcData;
+
+ SSLCertCollectionString certcol = ConnObjectIter->second->BuildSSLCollection();
+
+ bool *PauseMode = new bool;
+ QRNotif qrn;
+
+ *PauseMode = TRUE;
+ qrn.QResponse = &SSLResult;
+ qrn.PausePtr = PauseMode;
+
+ SSLICNProcData.CertCollection = certcol;
+ SSLICNProcData.QRNotifData = &qrn;
+ SSLICNProcData.AccountName = AccountNameFriendly;
+
+ wxCommandEvent event(INVALIDSSLCERTSTRING);
+ event.SetClientData(&SSLICNProcData);
+ wxPostEvent(frmMainPtrGet, event);
+
+ while (*PauseMode == TRUE){
+ //nanosleep(&n1, &n2);
+ SleepFor(250000000);
+ }
+
+ // Process the response from the user.
+
+ if (SSLResult == 1){
+
+ // Accept the Certificate.
+
+ UsingSSLBypass = true;
+ ConnObjectIter->second->BypassSSLVerification(true);
+
+ COConnectResult TestConnectionResult = ConnObjectIter->second->Connect(true);
+ WriteServerCertificate(AccountDir, certcol);
+
+ ConnObjectIter->second->BypassSSLVerification(false);
+
+ } else if (SSLResult == 2){
+
+ // Reject the certificate, abort the task and mark as failed.
+
+ iter->second = 2;
+ break;
+
+ }
+
+#endif
+
+ frmMainPtrGet->ResumeAllTimers();
+ ExitLoop = true;
+
+ } else if (ConnectResponse == COCONNECT_AUTHFAIL){
+
+ ConnectResponse = ConnObjectIter->second->Connect(true);
+
+ if (ConnectResponse == COCONNECT_OK){
+
+ ExitLoop = true;
+ break;
+
+ } else {
+
+ ExitLoop = true;
+ iter->second = 2;
+ break;
+
+ }
+
+ } else if (ConnectResponse == COCONNECT_OK){
+
+ ConnectResponse = ConnObjectIter->second->Connect(true);
+
+ ExitLoop = true;
+ break;
+
+ } else {
+
+ ExitLoop = true;
+ iter->second = 2;
+ break;
+
+ }
+
+ /*int ErrorCode = ConnHandle.SSLVerifyTest();
if (ErrorCode != CURLE_OK){
event.SetClientData(&SSLICNProcData);
wxPostEvent(frmMainPtrGet, event);
- /*timespec n1, n2;
-
- // Fall asleep until we get an response.
-
- n1.tv_sec = 0;
- n1.tv_nsec = 250000000L;*/
-
while (*PauseMode == TRUE){
//nanosleep(&n1, &n2);
SleepFor(250000000);
ExitLoop = TRUE;
- }
+ }*/
}
#endif
- ConnHandle.SetUploadMode(FALSE);
+ /*ConnHandle.SetUploadMode(FALSE);
ConnHandle.SetupData(wxT("DELETE"), ContactFilename, wxT(""));
ConnHandle.ProcessData();
if (ErrorCode != CURLE_OK){
iter->second = 2;
break;
+ }*/
+
+ COServerResponse DeleteContactResponse = ConnObjectIter->second->DeleteContact(ContactFilename.ToStdString());
+
+ if (DeleteContactResponse.RequestResult != COREQUEST_OK){
+ iter->second = 2;
+ break;
}
ETagDBPtr->RemoveETag(ContactFilename);
iter->second = 4;
- CardDAVIter->second = NULL;
+ //CardDAVIter->second = NULL;
break;
}