Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Check server address matches against the blacklist, bring up dialog if so
[xestiaab/.git] / source / frmNewAccount.cpp
index 1e23c21..49d278e 100644 (file)
@@ -24,6 +24,7 @@
 
 #include "carddav/carddav.h"
 #include "common/dirs.h"
+#include "common/svrblist.h"
 #include "frmInvalidSSLCertificate.h"
 
 frmNewAccount::frmNewAccount( wxWindow* parent )
@@ -127,6 +128,20 @@ void frmNewAccount::ProcessNext( wxCommandEvent& event )
             
                }
         
+               // Check if server address matches against the blacklist.
+               // Bring up warning message if it does.
+               
+               if (CheckBlacklist(txtServerAddress->GetValue())){
+               
+                       int MessageBoxResult = wxMessageBox(_("The server with the address given does not support the CardDAV protocol properly and shouldn't be used.\n\nData loss is very likely.\n\nDo you still want to continue using this server?"), _("Server warning"), wxYES_NO, this);
+               
+                       if (MessageBoxResult == wxNO){
+                               PageSeek--;
+                               return;
+                       }
+                       
+               }
+               
                btnNext->Disable();
         
                bool ServerResult = FALSE;
@@ -183,36 +198,13 @@ void frmNewAccount::ProcessNext( wxCommandEvent& event )
 
                                // Setup the data to be sent in the wxPostEvent command.
 
-                               //SSLInvalidCertNotifObj SSLICNProcData;
-
-                               //bool *PauseMode = new bool;
                                int SSLResult;
-                               //QRNotif qrn;
-
-                               //*PauseMode = TRUE;            
-                               //qrn.QResponse = &SSLResult;
-                               //qrn.PausePtr = PauseMode;
-                               
-                               //SSLICNProcData.CertCollection = CardDAVConn.GetSSLVerifyResults();
-                               //SSLICNProcData.QRNotifData = &qrn;
-                               //SSLICNProcData.AccountName = _("New account");
                        
                                frmInvalidSSLCertificate *frmICPtr = new frmInvalidSSLCertificate(this);
 
                                frmICPtr->LoadDataNew(CardDAVConn.GetSSLVerifyResults(), txtServerAddress->GetValue());
                                frmICPtr->ShowModal();
-                       
-                               //wxCommandEvent event(INVALIDSSLCERT);
-                               //event.SetClientData(&SSLICNProcData);
-                               //wxPostEvent(this->GetParent(), event);
-       
-                               /*timespec n1, n2;
-               
-                               // Fall asleep until we get an response.
-               
-                               n1.tv_sec = 0;
-                               n1.tv_nsec = 250000000L;*/
-                                       
+                                                               
                                SSLResult = frmICPtr->GetResult();
                                                        
                                // Clean up before processing response.
@@ -238,12 +230,6 @@ void frmNewAccount::ProcessNext( wxCommandEvent& event )
                                                                
                                }
 
-                               //frmInvalidSSLCertificate *frmICPtr = new frmInvalidSSLCertificate(this);
-
-                               //frmICPtr->LoadDataNew(CardDAVConn.GetSSLVerifyResults(), txtServerAddress->GetValue());
-                               //frmICPtr->ShowModal();
-                               
-
                        } else {
 
                                // Something else happened. Stop the process and
@@ -263,57 +249,57 @@ void frmNewAccount::ProcessNext( wxCommandEvent& event )
         
                if (ServerResult == FALSE){
             
-                   lblServerConnResult->SetLabel(_("Failed"));
-                   return;
+                       lblServerConnResult->SetLabel(_("Failed"));
+                       return;
             
                } else {
             
-                   lblServerConnResult->SetLabel(_("Connected"));
+                       lblServerConnResult->SetLabel(_("Connected"));
             
                }
         
                if (CardDAVConn.CanDoSSL() == TRUE){
             
-                   lblServerSSLResult->SetLabel(_("Used"));
+                       lblServerSSLResult->SetLabel(_("Used"));
             
                } else {
             
-                   lblServerSSLResult->SetLabel(_("Not Used"));
-                   lblServerSSLValid->SetLabel(_("Not Applicable"));
+                       lblServerSSLResult->SetLabel(_("Not Used"));
+                       lblServerSSLValid->SetLabel(_("Not Applicable"));
             
                }
         
                if (CardDAVConn.SSLVerify() == TRUE && CardDAVConn.CanDoSSL() == TRUE){
             
-                   lblServerSSLValid->SetLabel(_("Verified"));
+                       lblServerSSLValid->SetLabel(_("Verified"));
             
                } else if (CardDAVConn.SSLVerify() == FALSE && CardDAVConn.CanDoSSL() == TRUE && CardDAVConn.IsSelfSigned() == TRUE){
        
-                   lblServerSSLValid->SetLabel(_("Verified (user)"));
+                       lblServerSSLValid->SetLabel(_("Verified (user)"));
        
                } else if (CardDAVConn.SSLVerify() == FALSE && CardDAVConn.CanDoSSL() == TRUE) {
             
-                   lblServerSSLValid->SetLabel(_("Unable to verify"));
+                       lblServerSSLValid->SetLabel(_("Unable to verify"));
             
                }       
         
                if (CardDAVConn.CanDoCardDAV() == TRUE){
             
-                   lblCardDAVSupportResult->SetLabel(_("Supported"));
+                       lblCardDAVSupportResult->SetLabel(_("Supported"));
             
                } else {
             
-                   lblCardDAVSupportResult->SetLabel(_("Unsupported"));
+                       lblCardDAVSupportResult->SetLabel(_("Unsupported"));
             
                }
         
                if (CardDAVConn.AbleToLogin() == TRUE){
             
-                   lblAbleToLoginResult->SetLabel(_("Yes"));
+                       lblAbleToLoginResult->SetLabel(_("Yes"));
             
                } else {
             
-                   lblAbleToLoginResult->SetLabel(_("No"));
+                       lblAbleToLoginResult->SetLabel(_("No"));
             
                }
         
@@ -323,25 +309,25 @@ void frmNewAccount::ProcessNext( wxCommandEvent& event )
         
                if (CardDAVConn.HasValidResponse() == TRUE){
             
-                   lblServerResponse->SetLabel(_("Yes"));
+                       lblServerResponse->SetLabel(_("Yes"));
             
                } else {
             
-                   lblServerResponse->SetLabel(_("No"));
+                       lblServerResponse->SetLabel(_("No"));
             
                }
         
                if (ServerResult == TRUE && CardDAVConn.HasValidResponse() == TRUE &&
-                   //CardDAVConn.CanDoSSL() == TRUE && CardDAVConn.SSLVerify() == TRUE &&
-                   CardDAVConn.CanDoCardDAV() == TRUE && CardDAVConn.AbleToLogin() == TRUE){
+
+                       CardDAVConn.CanDoCardDAV() == TRUE && CardDAVConn.AbleToLogin() == TRUE){
             
-                   btnNext->Enable();
+                       btnNext->Enable();
             
-                   lblConnectionResultText->SetLabel(_("Click on Next to set the account name."));
+                       lblConnectionResultText->SetLabel(_("Click on Next to set the account name."));
             
                } else {
             
-                   lblConnectionResultText->SetLabel(_("A problem has occured whilst connecting to the CardDAV server.\nPlease review the above information and change the server details if needed.\nIf there are still problems, please speak to your system administrator(s)."));
+                       lblConnectionResultText->SetLabel(_("A problem has occured whilst connecting to the CardDAV server.\nPlease review the above information and change the server details if needed.\nIf there are still problems, please speak to your system administrator(s)."));
             
                }
         
@@ -359,11 +345,11 @@ void frmNewAccount::ProcessNext( wxCommandEvent& event )
        
                if (txtAccountName->IsEmpty() && PageSeek == 2){
        
-                   btnNext->Disable();
+                       btnNext->Disable();
            
                } else {
        
-                   btnNext->Enable();
+                       btnNext->Enable();
            
                }
         
@@ -602,7 +588,7 @@ void frmNewAccount::CloseWindow( wxCommandEvent& event )
 void frmNewAccount::UpdateRequirements( wxCommandEvent& event )
 {
     
-    // Update the options.
+       // Update the options.
     
        if (cmbServerType->GetCurrentSelection() == 1){
         
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