+ // Verify SSL trust first before doing anything.
+
+ if (UseSSL == TRUE){
+
+ CURLcode sslcode = CardDAVConn.SSLVerifyTest();
+
+ if (sslcode == CURLE_OK){
+
+
+
+ } else if (sslcode == CURLE_SSL_CACERT || sslcode == CURLE_SSL_CONNECT_ERROR){
+
+ // Certificate is more than likely a self-signed or
+ // expired certificate so display the invalid
+ // SSL certificate message.
+
+ // 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.
+
+ delete frmICPtr;
+ frmICPtr = NULL;
+
+ // Process the response from the user.
+
+ if (SSLResult == 1){
+
+ // Accept the Certificate.
+
+ CardDAVConn.AllowSelfSignTest(TRUE);
+
+ } else if (SSLResult == 2){
+
+ // Reject the certificate, abort the task and mark as failed.
+
+ lblServerConnResult->SetLabel(_("Failed"));
+ lblConnectionResultText->SetLabel(_("An error occured whilst connnecting: ") + CardDAVConn.GetErrorMessage() + wxString::Format(wxT(" (%i)\n%s"), sslcode, CardDAVConn.GetErrorBuffer().mb_str()));
+ return;
+
+ }
+
+ //frmInvalidSSLCertificate *frmICPtr = new frmInvalidSSLCertificate(this);
+
+ //frmICPtr->LoadDataNew(CardDAVConn.GetSSLVerifyResults(), txtServerAddress->GetValue());
+ //frmICPtr->ShowModal();
+
+
+ } else {
+
+ // Something else happened. Stop the process and
+ // display an error message instead.
+
+ lblServerConnResult->SetLabel(_("Failed"));
+ lblConnectionResultText->SetLabel(_("An error occured whilst connnecting: ") + CardDAVConn.GetErrorMessage() + wxString::Format(wxT(" (%i)\n%s"), sslcode, CardDAVConn.GetErrorBuffer().mb_str()));
+ return;
+
+ }
+
+ }
+