- /*while (ExitLoop == FALSE){
-
- int ErrorCode = ConnHandle.SSLVerifyTest();
-
- if (ErrorCode != CURLE_OK){
-
- if (ErrorCode == CURLE_SSL_CACERT ||
- ErrorCode == CURLE_PEER_FAILED_VERIFICATION ||
- ErrorCode == CURLE_SSL_CONNECT_ERROR){
-
- // Invalid SSL certificate so bring up a dialog to the user
- // explaining what has happened and the options available.
-
- // Stop all the timers.
-
- frmMainPtrGet->PauseAllTimers();
-
- int SSLResult;
-
-#if defined(__APPLE__)
-
- // Bring up the trust panel and display the SSL certificate dialog.
-
- SSLResult = DisplayTrustPanel(ConnHandle.GetTrustObject(), AccountNameFriendly);
-
- // Update the SSL account with the trust object.
-
- if (SSLResult != NSOKButton){
-
- frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 1, ConnHandle.GetTrustObject());
- iter->second = 2;
- break;
-
- } else {
-
- frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 0, ConnHandle.GetTrustObject());
-
- }
-
-#elif defined(__WIN32__)
-
- BOOL ModifiedCertificateData;
- CRYPTUI_VIEWCERTIFICATE_STRUCTW CertificateData = BuildCertificateData(&ConnHandle, (HWND)frmMainPtrGet->GetHandle());
-
- if (!CryptUIDlgViewCertificate(&CertificateData, &ModifiedCertificateData)){
- wxMessageBox(_("An error occured while trying to open the certificate dialog."), _("Error opening Certificate Information dialog"));
- }
-
- if (ModifiedCertificateData == FALSE){
-
- frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 1, ConnHandle.GetCertificateContextPointer());
- iter->second = 2;
- break;
-
- } else {
-
- frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 0, ConnHandle.GetCertificateContextPointer());
-
- }
-
-#else
-
- // Setup the data to be sent in the wxPostEvent command.
-
- SSLInvalidCertNotifObj SSLICNProcData;
-
- SSLCertCollection certcol = ConnHandle.GetSSLVerifyResults();
-
- 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(INVALIDSSLCERT);
- 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. Write the certificate into the account
- // directory (as server.crt) - will overwrite old certificate.
-
- frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 0, ConnHandle.GetSSLVerifyResults());
- WriteServerCertificate(AccountDir, ConnHandle.GetSSLVerifyResults());
-
- } else if (SSLResult == 2){
-
- // Reject the certificate, abort the task and mark as failed.
-
- frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 1, ConnHandle.GetSSLVerifyResults());
- iter->second = 2;
- break;
-
- }
-
-#endif
-
- // Resume all the timers.
-
- frmMainPtrGet->ResumeAllTimers();
- ExitLoop = TRUE;
-
- } else {
-
- iter->second = 2;
- break;
-
- }
-
- } else {
-
- ExitLoop = TRUE;
-
- }
-
- }
-
- if (iter->second == 2 || iter->second == 3 || iter->second == 4){
- break;
- }
-
-#if defined(__APPLE__)
-
- frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 0, ConnHandle.GetTrustObject());
-
-#elif defined(__WIN32__)
-
- frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 0, ConnHandle.GetCertificateContextPointer());
-
-#else
-
- frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 0, ConnHandle.GetSSLVerifyResults());
-
-#endif
-
- ConnHandle.SetUploadMode(TRUE);
- ConnHandle.SetupData(wxT("PUT"), StringURLIter->second, StringDataIter->second);
- ConnHandle.SetEditMode(EditMode);
- ConnHandle.GetServerETagValueThread();
- ETagServer = ConnHandle.ETagValueResult();
-
- int ErrorCode = ConnHandle.GetResultCode();
-
- if (ErrorCode != CURLE_OK){
- iter->second = 2;
- break;
- }
-
- // Compare the ETag with the Server ETag.
-
- if (ETagOriginal != ETagServer){
-
- // Server ETag is different from original ETag.
- // This is a conflict which the user will now
- // need to resolve.
-
- vCard Moo1;
- vCard Moo2;
-
- frmMain *frmMainPtrGet = static_cast<frmMain*>(frmMainPtr);
-
- vCard34Conv vCard34Obj;
-
- wxString ServerContactData;
- vCard ClientData;
- vCard ConvertedV4Data;
-
- // Load the client data from the filename given.
-
- ConnHandle.GetServerContactData();
- ServerContactData = ConnHandle.GetPageData();
-
- // Process v3 version into v4 version.
-
- vCard34Obj.ConvertToV4(&ServerContactData, &ConvertedV4Data);
-
- vCardConflictObj vCardProcData;
-
- vCardProcData.vCardLocalData = &ClientData;
- vCardProcData.vCardServerData = &ConvertedV4Data;
- ClientData.LoadFile(FullFilename);
-
- //ContactConflictEvent event(ContactConflictCmdEnv);
- //event.SetData(ContactFilename, Moo1, Moo2);
-
- //wxPostEvent(frmMainPtrGet, event);
-
- // Setup Conflict Resolution Dialog.
-
- // Fetch Data from Server and convert.
-
- bool *PauseMode = new bool;
- int ConflictResult;
- QRNotif qrn;
-
- *PauseMode = TRUE;
- qrn.QResponse = &ConflictResult;
- qrn.PausePtr = PauseMode;
-
- vCardProcData.QRNotifData = &qrn;
-
- wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED);
- event.SetClientData(&vCardProcData);
- wxPostEvent(frmMainPtrGet, event);
-
- while (*PauseMode == TRUE){
- //nanosleep(&n1, &n2);
- SleepFor(250000000);
- }
-
- delete PauseMode;
- PauseMode = NULL;
-
- //intResult = frmMainPtrGet->ShowConflictDialog(&Moo1, &Moo2);
-
- if (ConflictResult == 0){
-
- // Decide Later.
-
- iter->second = 4;
- break;
-
- } else if (ConflictResult == 1){
-
- // Decided to use client version.
-
- //ConnHandle.ProcessData();
-
- } else if (ConflictResult == 2){
-
- // Decided to use server version.
-
- // Download server version.
-
- ConvertedV4Data.WriteFile(FullFilename);
-
- }
-
- } else {
-
- // Update the data to the server.
-
- ConnHandle.ProcessData();
-
- }*/
-
- // Update the ETag DB.
-
- //ConnHandle.GetServerETagValueThread();
- //ETagServer = ConnHandle.ETagValueResult();
-