Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Merge commits from upstream
[xestiaab/.git] / source / frmMain.cpp
index 59c3770..6625432 100644 (file)
@@ -1399,6 +1399,19 @@ void frmMain::LoadPreferences(){
                AccTmrPtr = NULL;
         
        }
+
+#if defined(__WIN32__)
+
+       for (std::map<int, PCCERT_CONTEXT>::iterator CertificateIter = AccountCertificateData.begin();
+               CertificateIter != AccountCertificateData.end(); CertificateIter++){
+
+               CertFreeCertificateContext(CertificateIter->second);
+
+       }
+
+       AccountCertificateData.clear();
+
+#endif
     
        AccountSyncTimers.clear();
         
@@ -2531,7 +2544,63 @@ void frmMain::ShowSSLCertificates( wxCommandEvent &event ){
                 AccType.clear();
                 
         }
-    
+   
+#elif defined(__WIN32__)
+
+       std::map<int, PCCERT_CONTEXT>::iterator SSLCertificateIter;
+
+       for (int i = 0; i < prefaccounts.GetCount(); i++){
+
+               SeekAccount.Append(prefaccounts.GetAccountDirectory(i));
+               AccType.Append(prefaccounts.GetAccountType(i));
+               AccountSSL = prefaccounts.GetAccountSSL(i);
+               AccTypeLower = AccType.MakeLower();
+               SeekAccount.Append(wxT("."));
+               SeekAccount.Append(AccTypeLower);
+
+               if (SeekAccount == ActiveAccount){
+
+                       if (AccTypeLower == wxT("local")){
+
+                               return;
+
+                       }
+
+                       if (AccountSSL == false){
+
+                               return;
+
+                       }
+
+                       SSLCertificateIter = AccountCertificateData.find(i);
+
+                       // Setup and display the form.
+
+                       if (SSLCertificateIter->second->pCertInfo == NULL){
+
+                               wxMessageBox("No certificate information is available due to invalid connection details, connection being in progress or invalid certificate data received.");
+
+                       } else {
+
+                               BOOL ModifiedCertificateData;
+                               CRYPTUI_VIEWCERTIFICATE_STRUCTW CertificateData = BuildCertificateData(SSLCertificateIter->second, (HWND)this->GetHandle());
+
+                               if (!CryptUIDlgViewCertificate(&CertificateData, &ModifiedCertificateData)){
+                                       wxMessageBox(_("An error occured while trying to open the certificate dialog."), _("Error opening Certificate Information dialog"));
+                               }
+
+                       }
+
+                       //DisplayCertificate(SSLTrustIter->second);
+
+               }
+
+               SeekAccount.Clear();
+               AccTypeLower.Clear();
+               AccType.clear();
+
+       }
+
 #else
     
        std::map<int, SSLCertCollection>::iterator SSLColIter;
@@ -2662,6 +2731,28 @@ void frmMain::ResumeAllTimers(){
 
 #if defined(__APPLE__)
 
+#elif defined(__WIN32__)
+
+void frmMain::UpdateSSLAccountStatus(int AccountID, int SSLStatus, PCCERT_CONTEXT CertificateContext){
+
+       // Delete existing data.
+
+       std::map<int, PCCERT_CONTEXT>::iterator CertificateIter = AccountCertificateData.find(AccountID);
+
+       if (CertificateIter != AccountCertificateData.end()){
+               CertFreeCertificateContext(CertificateIter->second);
+       }
+
+       AccountCertificateData.erase(AccountID);
+       AccountSSLResult.erase(AccountID);
+
+       // Insert new data.
+
+       AccountCertificateData.insert(std::make_pair(AccountID, CertificateContext));
+       AccountSSLResult.insert(std::make_pair(AccountID, SSLStatus));
+
+}
+
 #else
 
 void frmMain::UpdateSSLAccountStatus(int AccountID, int SSLStatus, SSLCertCollection SSLCertInc){
@@ -2715,6 +2806,16 @@ void frmMain::SetupSSLStatus( int AccountID ){
                 
                 std::map<int,int>::iterator SSLResultIter = AccountSSLResult.find(AccountID);
                 
+               // Check if a result value has been set.
+
+               if (SSLResultIter == AccountSSLResult.end()){
+
+                       imgSSLStatus->SetBitmap(*imgSSLWarning);
+                       SSLToolTip->SetTip(wxT("Unable to determine SSL information for the '") + prefaccounts.GetAccountName(AccountID) + wxT("' account."));
+                       return;
+
+               }
+
                 if (SSLResultIter->second == 1){
                         
                         imgSSLStatus->SetBitmap(*imgSSLWarning);
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