Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Win32 Support: Support for processing tasks within frmActivityMgr and updating the...
authorSteve Brokenshire <sbrokenshire@xestia.co.uk>
Mon, 16 May 2016 21:05:17 +0000 (22:05 +0100)
committerSteve Brokenshire <sbrokenshire@xestia.co.uk>
Mon, 16 May 2016 21:05:17 +0000 (22:05 +0100)
source/actmgr/frmActivityMgr.cpp

index 006c668..e9c4469 100644 (file)
@@ -323,13 +323,10 @@ void frmActivityMgr::ProcessTasksThread()
                                        
                                        while (ExitLoop == FALSE){
                                                
-                                               ConnHandle.SetUploadMode(TRUE);
-                                               ConnHandle.SetupData(wxT("PUT"), StringURLIter->second, StringDataIter->second);
-                                               ConnHandle.SetEditMode(EditMode);
-                                               ConnHandle.ProcessData();
-                                               
-                                               int ErrorCode = ConnHandle.GetResultCode();
+                                               // Verify that we have a trusted SSL connection first.
                                                
+                                               int ErrorCode = ConnHandle.SSLVerifyTest();
+
                                                if (ErrorCode != CURLE_OK){
                                                        
                                                        if (ErrorCode == CURLE_SSL_CACERT ||
@@ -363,7 +360,30 @@ void frmActivityMgr::ProcessTasksThread()
                                                                        
                                                                        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.
@@ -448,13 +468,31 @@ void frmActivityMgr::ProcessTasksThread()
 #if defined(__APPLE__)
                                        
                                        frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 0, ConnHandle.GetTrustObject());
-                                       
+
+#elif defined(__WIN32__)
+
+                                       frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 0, ConnHandle.GetCertificateContextPointer());
+
 #else
                                        
                                        frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 0, ConnHandle.GetCertificateData());
                                        
 #endif
                                        
+                                       ConnHandle.SetUploadMode(TRUE);
+                                       ConnHandle.SetupData(wxT("PUT"), StringURLIter->second, StringDataIter->second);
+                                       ConnHandle.SetEditMode(EditMode);
+                                       ConnHandle.ProcessData();
+
+                                       int ErrorCode = ConnHandle.GetResultCode();
+
+                                       if (ErrorCode != CURLE_OK){
+
+                                               iter->second = 4;
+                                               break;
+
+                                       }
+
                                        // Add contact to the ETag DB.
                                        
                                        ConnHandle.GetServerETagValueThread();
@@ -462,7 +500,6 @@ void frmActivityMgr::ProcessTasksThread()
                                        ETagDBPtr->AddETag(ContactFilename, ETagServer, ETagServer);
                                        
                                        iter->second = 4;
-                                       CardDAVIter->second = NULL;
                                        break;
                                        
                                }
@@ -512,14 +549,8 @@ void frmActivityMgr::ProcessTasksThread()
                                        bool ExitLoop = FALSE;
                                        
                                        while (ExitLoop == FALSE){
-                                               
-                                               ConnHandle.SetUploadMode(TRUE);
-                                               ConnHandle.SetupData(wxT("PUT"), StringURLIter->second, StringDataIter->second);
-                                               ConnHandle.SetEditMode(EditMode);
-                                               ConnHandle.GetServerETagValueThread();
-                                               ETagServer = ConnHandle.ETagValueResult();
-                                               
-                                               int ErrorCode = ConnHandle.GetResultCode();
+                                                
+                                               int ErrorCode = ConnHandle.SSLVerifyTest();
                                                
                                                if (ErrorCode != CURLE_OK){
                                                        
@@ -555,6 +586,28 @@ void frmActivityMgr::ProcessTasksThread()
                                                                        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.
@@ -632,13 +685,30 @@ void frmActivityMgr::ProcessTasksThread()
 #if defined(__APPLE__)
                                        
                                        frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 0, ConnHandle.GetTrustObject());
-                                       
+
+#elif defined(__WIN32__)
+
+                                       frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 0, ConnHandle.GetCertificateContextPointer());
+
 #else
                                        
                                        frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 0, ConnHandle.GetCertificateData());
                                        
 #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){
@@ -784,15 +854,8 @@ void frmActivityMgr::ProcessTasksThread()
                                        
                                        while (ExitLoop == FALSE){
                                                
-                                               ConnHandle.SetUploadMode(FALSE);
-                                               ConnHandle.SetupData(wxT("DELETE"), ContactFilename, wxT(""));
-                                               ConnHandle.ProcessData();
-                                               SSLCertCollection certcol = ConnHandle.GetCertificateData();
-                                               
-                                               // Check if any errors have occured whilst getting the data.
-                                               
-                                               int ErrorCode = ConnHandle.GetResultCode();
-                                               
+                                               int ErrorCode = ConnHandle.SSLVerifyTest();
+
                                                if (ErrorCode != CURLE_OK){
                                                        
                                                        if (ErrorCode == CURLE_SSL_CACERT ||
@@ -827,6 +890,28 @@ void frmActivityMgr::ProcessTasksThread()
                                                                        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.
@@ -909,13 +994,30 @@ void frmActivityMgr::ProcessTasksThread()
 #if defined(__APPLE__)
                                
                                        frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 0, ConnHandle.GetTrustObject());
-                               
+
+#elif defined(__WIN32__)
+
+                                       frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 0, ConnHandle.GetCertificateContextPointer());
+
 #else
                                
                                        frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 0, ConnHandle.GetCertificateData());
                                
 #endif
 
+                                       ConnHandle.SetUploadMode(FALSE);
+                                       ConnHandle.SetupData(wxT("DELETE"), ContactFilename, wxT(""));
+                                       ConnHandle.ProcessData();
+                                       SSLCertCollection certcol = ConnHandle.GetCertificateData();
+
+                                       // Check if any errors have occured whilst getting the data.
+
+                                       int ErrorCode = ConnHandle.GetResultCode();
+
+                                       if (ErrorCode != CURLE_OK){
+                                               iter->second = 2;
+                                               break;
+                                       }
                                
                                        ETagDBPtr->RemoveETag(ContactFilename);
                                
@@ -1068,6 +1170,17 @@ void frmActivityMgr::ProcessTasksThread()
                                                                        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.
@@ -1150,7 +1263,11 @@ void frmActivityMgr::ProcessTasksThread()
 #if defined(__APPLE__)
                                         
                                         frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 0, ConnHandle.GetTrustObject());
-                                        
+
+#elif defined(__WIN32__)
+
+                                       frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 0, ConnHandle.GetCertificateContextPointer());
+
 #else
                                         
                                        frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 0, ConnHandle.GetCertificateData());
@@ -1171,6 +1288,16 @@ void frmActivityMgr::ProcessTasksThread()
                                        bool ContinueProcess = AccDir.GetFirst(&AccDirFilename, wxEmptyString, wxDIR_DEFAULT);
                                
                                        ServerContactList = ConnHandle.GetContactList(SyncTokenLoad.ToUTF8());
+
+                                       int ErrorCode = ConnHandle.GetResultCode();
+
+                                       if (ErrorCode != CURLE_OK){
+
+                                               iter->second = 4;
+                                               break;
+
+                                       }
+
                                        SSLCertCollection certcol = ConnHandle.GetCertificateData();
 
                                        // Create a pointer for the std::map<wxString,FileSyncData>.
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy