Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
frmActivityMgr: UTF-8 support for adding/editing contacts implemented
[xestiaab/.git] / source / actmgr / frmActivityMgr.cpp
index a066d8f..be5f40a 100644 (file)
@@ -330,7 +330,54 @@ void frmActivityMgr::ProcessTasksThread()
                                                        frmMainPtrGet->PauseAllTimers();
                                                        
 #if defined(__APPLE__)
+
+                                                       ConnObjectIter->second->BypassSSLVerification(true);
+                                                       
+                                                       COConnectResult ConnectionSSLResult = ConnObjectIter->second->Connect(false);
+                                                       
+                                                       ConnObjectIter->second->BypassSSLVerification(false);
+                                                       
+                                                       int SSLResult = DisplayTrustPanel(ConnObjectIter->second->BuildSSLCollection(), AccountNameFriendly);
+                                                       
+                                                       if (SSLResult != NSOKButton){
+                                                               
+                                                               frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 1, ConnObjectIter->second->BuildSSLCollection());
+                                                               iter->second = 2;
+                                                               break;
+                                                               
+                                                       } else {
+                                                               
+                                                               frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 0, ConnObjectIter->second->BuildSSLCollection());
+                                                               
+                                                       }
+                                                       
 #elif defined(__WIN32__)
+
+                                                       ConnObjectIter->second->BypassSSLVerification(true);
+
+                                                       COConnectResult ConnectionSSLResult = ConnObjectIter->second->Connect(false);
+
+                                                       ConnObjectIter->second->BypassSSLVerification(false);
+
+                                                       BOOL ModifiedCertificateData = false;
+                                                       CRYPTUI_VIEWCERTIFICATE_STRUCTW CertificateData = BuildCertificateData(ConnObjectIter->second, (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, ConnObjectIter->second->BuildSSLCollection());
+                                                               iter->second = 2;
+                                                               break;
+
+                                                       } else {
+
+                                                               frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 0, ConnObjectIter->second->BuildSSLCollection());
+
+                                                       }
+
 #else
        
                                                        bool UsingSSLBypass = false;
@@ -436,7 +483,7 @@ void frmActivityMgr::ProcessTasksThread()
                                        
 #if defined(__APPLE__)
                                        
-                                       frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 0, ConnHandle.GetTrustObject());
+                                       frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 0, ConnObjectIter->second->BuildSSLCollection());
 
 #elif defined(__WIN32__)
 
@@ -449,7 +496,7 @@ void frmActivityMgr::ProcessTasksThread()
 #endif
                                        
                                        COServerResponse AddContactResponse = ConnObjectIter->second->AddContact(StringURLIter->second.ToStdString(), 
-                                                       StringDataIter->second.ToStdString());
+                                                       std::string(StringDataIter->second.ToUTF8()));
                                        
                                        if (AddContactResponse.RequestResult != COREQUEST_OK){
                                                iter->second = 2;
@@ -465,8 +512,6 @@ void frmActivityMgr::ProcessTasksThread()
                                                break;
                                        }
                                        
-                                       std::cout << ETagGetResponse.EntityTag << std::endl;
-                                       
                                        ETagDBPtr->UpdateETag(ContactFilename, ETagGetResponse.EntityTag, ETagGetResponse.EntityTag);
                                        
                                        iter->second = 4;
@@ -527,7 +572,54 @@ void frmActivityMgr::ProcessTasksThread()
                                                        frmMainPtrGet->PauseAllTimers();
                                                        
 #if defined(__APPLE__)
+                                                       
+                                                       ConnObjectIter->second->BypassSSLVerification(true);
+                                                       
+                                                       COConnectResult ConnectionSSLResult = ConnObjectIter->second->Connect(false);
+                                                       
+                                                       ConnObjectIter->second->BypassSSLVerification(false);
+                                                       
+                                                       int SSLResult = DisplayTrustPanel(ConnObjectIter->second->BuildSSLCollection(), AccountNameFriendly);
+                                                       
+                                                       if (SSLResult != NSOKButton){
+                                                               
+                                                               frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 1, ConnObjectIter->second->BuildSSLCollection());
+                                                               iter->second = 2;
+                                                               break;
+                                                               
+                                                       } else {
+                                                               
+                                                               frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 0, ConnObjectIter->second->BuildSSLCollection());
+                                                               
+                                                       }
+                                                       
 #elif defined(__WIN32__)
+
+                                                       ConnObjectIter->second->BypassSSLVerification(true);
+
+                                                       COConnectResult ConnectionSSLResult = ConnObjectIter->second->Connect(false);
+
+                                                       ConnObjectIter->second->BypassSSLVerification(false);
+
+                                                       BOOL ModifiedCertificateData = false;
+                                                       CRYPTUI_VIEWCERTIFICATE_STRUCTW CertificateData = BuildCertificateData(ConnObjectIter->second, (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, ConnObjectIter->second->BuildSSLCollection());
+                                                               iter->second = 2;
+                                                               break;
+
+                                                       } else {
+
+                                                               frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 0, ConnObjectIter->second->BuildSSLCollection());
+
+                                                       }
+
 #else
        
                                                        bool UsingSSLBypass = false;
@@ -729,7 +821,7 @@ void frmActivityMgr::ProcessTasksThread()
                                                // Upload the data to the server.
                                                
                                                COServerResponse EditContactResponse = ConnObjectIter->second->EditContact(StringURLIter->second.ToStdString(), 
-                                                       StringDataIter->second.ToStdString());
+                                                       std::string(StringDataIter->second.ToUTF8()));
                                        
                                                if (EditContactResponse.RequestResult != COREQUEST_OK){
                                                        iter->second = 2;
@@ -795,7 +887,54 @@ void frmActivityMgr::ProcessTasksThread()
                                                        frmMainPtrGet->PauseAllTimers();
                                                        
 #if defined(__APPLE__)
+                                                       
+                                                       ConnObjectIter->second->BypassSSLVerification(true);
+                                                       
+                                                       COConnectResult ConnectionSSLResult = ConnObjectIter->second->Connect(false);
+                                                       
+                                                       ConnObjectIter->second->BypassSSLVerification(false);
+                                                       
+                                                       int SSLResult = DisplayTrustPanel(ConnObjectIter->second->BuildSSLCollection(), AccountNameFriendly);
+                                                       
+                                                       if (SSLResult != NSOKButton){
+                                                               
+                                                               frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 1, ConnObjectIter->second->BuildSSLCollection());
+                                                               iter->second = 2;
+                                                               break;
+                                                               
+                                                       } else {
+                                                               
+                                                               frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 0, ConnObjectIter->second->BuildSSLCollection());
+                                                               
+                                                       }
+                                                       
 #elif defined(__WIN32__)
+
+                                                       ConnObjectIter->second->BypassSSLVerification(true);
+
+                                                       COConnectResult ConnectionSSLResult = ConnObjectIter->second->Connect(false);
+
+                                                       ConnObjectIter->second->BypassSSLVerification(false);
+
+                                                       BOOL ModifiedCertificateData = false;
+                                                       CRYPTUI_VIEWCERTIFICATE_STRUCTW CertificateData = BuildCertificateData(ConnObjectIter->second, (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, ConnObjectIter->second->BuildSSLCollection());
+                                                               iter->second = 2;
+                                                               break;
+
+                                                       } else {
+
+                                                               frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 0, ConnObjectIter->second->BuildSSLCollection());
+
+                                                       }
+
 #else
        
                                                        bool UsingSSLBypass = false;
@@ -901,7 +1040,7 @@ void frmActivityMgr::ProcessTasksThread()
                        
 #if defined(__APPLE__)
                                
-                                       frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 0, ConnHandle.GetTrustObject());
+                                       frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 0, ConnObjectIter->second->BuildSSLCollection());
 
 #elif defined(__WIN32__)
 
@@ -1024,7 +1163,54 @@ void frmActivityMgr::ProcessTasksThread()
                                                        frmMainPtrGet->PauseAllTimers();
                                                        
 #if defined(__APPLE__)
+                                                       
+                                                       ConnObjectIter->second->BypassSSLVerification(true);
+                                                       
+                                                       COConnectResult ConnectionSSLResult = ConnObjectIter->second->Connect(false);
+                                                       
+                                                       ConnObjectIter->second->BypassSSLVerification(false);
+                                                       
+                                                       int SSLResult = DisplayTrustPanel(ConnObjectIter->second->BuildSSLCollection(), AccountNameFriendly);
+                                                       
+                                                       if (SSLResult != NSOKButton){
+                                                               
+                                                               frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 1, ConnObjectIter->second->BuildSSLCollection());
+                                                               iter->second = 2;
+                                                               break;
+                                                               
+                                                       } else {
+                                                               
+                                                               frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 0, ConnObjectIter->second->BuildSSLCollection());
+                                                               
+                                                       }
+                                                       
 #elif defined(__WIN32__)
+
+                                                       ConnObjectIter->second->BypassSSLVerification(true);
+
+                                                       COConnectResult ConnectionSSLResult = ConnObjectIter->second->Connect(false);
+
+                                                       ConnObjectIter->second->BypassSSLVerification(false);
+
+                                                       BOOL ModifiedCertificateData = false;
+                                                       CRYPTUI_VIEWCERTIFICATE_STRUCTW CertificateData = BuildCertificateData(ConnObjectIter->second, (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, ConnObjectIter->second->BuildSSLCollection());
+                                                               iter->second = 2;
+                                                               break;
+
+                                                       } else {
+
+                                                               frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 0, ConnObjectIter->second->BuildSSLCollection());
+
+                                                       }
+
 #else
        
                                                        bool UsingSSLBypass = false;
@@ -1111,6 +1297,19 @@ void frmActivityMgr::ProcessTasksThread()
                                                        
                                                        ConnectResponse = ConnObjectIter->second->Connect(true);
                                                        
+                                                       if (ConnectResponse == COCONNECT_OK){
+                                                               
+                                                               ExitLoop = true;
+                                                               break;
+                                                               
+                                                       } else {
+                                                               
+                                                               ExitLoop = true;
+                                                               iter->second = 2;
+                                                               break;
+                                                               
+                                                       }
+                                                       
                                                        ExitLoop = true;
                                                        break;
                                                        
@@ -1126,7 +1325,7 @@ void frmActivityMgr::ProcessTasksThread()
                                
 #if defined(__APPLE__)
                                         
-                                        frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 0, ConnHandle.GetTrustObject());
+                                        frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 0, ConnObjectIter->second->BuildSSLCollection());
 
 #elif defined(__WIN32__)
 
@@ -1507,8 +1706,6 @@ void frmActivityMgr::ProcessTasksThread()
                                                                break;
                                                        }
                                                        
-                                                       // TODO: Continue from here!
-                                                       
                                                        ETagServer = wxString::FromUTF8(ServerEntityTag.EntityTag.c_str());
                                
                                                        if (ETagOriginal != ETagServer){
@@ -1584,7 +1781,7 @@ void frmActivityMgr::ProcessTasksThread()
                                        
                                                                        // Decided to use client version.
                                        
-                                                                       COServerResponse EditContactResponse = ConnObjectIter->second->EditContact(vCardAdd[vi].ToStdString(), ClientData.WriteString().ToStdString());
+                                                                       COServerResponse EditContactResponse = ConnObjectIter->second->EditContact(vCardAdd[vi].ToStdString(), std::string(ClientData.WriteString().ToUTF8()));
                                                
                                                                        if (EditContactResponse.RequestResult != COREQUEST_OK){
                                                                                iter->second = 2;
@@ -1633,7 +1830,7 @@ void frmActivityMgr::ProcessTasksThread()
 
                                                                // Upload the data to the server.
                                                                
-                                                               COServerResponse AddContactResponse = ConnObjectIter->second->AddContact(vCardAdd[vi].ToStdString(), TaskData.ToStdString());
+                                                               COServerResponse AddContactResponse = ConnObjectIter->second->AddContact(vCardAdd[vi].ToStdString(), std::string(TaskData.ToUTF8()));
                                                        
                                                                if (AddContactResponse.RequestResult != COREQUEST_OK){
                                                                        iter->second = 2;
@@ -1726,7 +1923,7 @@ void frmActivityMgr::ProcessTasksThread()
                                        
                                                                        // Decided to use client version.
                                                                
-                                                                       COServerResponse EditContactResponse = ConnObjectIter->second->EditContact(vCardAdd[vi].ToStdString(), ClientData.WriteString().ToStdString());
+                                                                       COServerResponse EditContactResponse = ConnObjectIter->second->EditContact(vCardAdd[vi].ToStdString(), std::string(ClientData.WriteString().ToUTF8()));
 
                                                                        if (EditContactResponse.RequestResult != COREQUEST_OK){
                                                                                iter->second = 2;
@@ -1775,7 +1972,7 @@ void frmActivityMgr::ProcessTasksThread()
 
                                                                // Upload the data to the server.
                                                                
-                                                               COServerResponse AddContactResponse = ConnObjectIter->second->AddContact(vCardAdd[vi].ToStdString(), TaskData.ToStdString());
+                                                               COServerResponse AddContactResponse = ConnObjectIter->second->AddContact(vCardAdd[vi].ToStdString(), std::string(TaskData.ToUTF8()));
 
                                                                if (AddContactResponse.RequestResult != COREQUEST_OK){
                                                                        iter->second = 2;
@@ -2076,4 +2273,4 @@ void frmActivityMgr::UpdateStatusLabel(wxCommandEvent& event){
        
        }
 
-}
\ No newline at end of file
+}
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