From 60187ed8a74a8e8c6e4032ec787ea0520289d9da Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Wed, 30 Mar 2016 13:20:18 +0100 Subject: [PATCH] Check server address matches against the blacklist, bring up dialog if so --- source/frmEditAccount.cpp | 14 ++++++++++++++ source/frmNewAccount.cpp | 15 +++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/source/frmEditAccount.cpp b/source/frmEditAccount.cpp index 18e5591..4883625 100644 --- a/source/frmEditAccount.cpp +++ b/source/frmEditAccount.cpp @@ -19,6 +19,7 @@ #include "frmEditAccount.h" #include "frmInvalidSSLCertificate.h" #include "carddav/carddav.h" +#include "common/svrblist.h" frmEditAccount::frmEditAccount( wxWindow* parent ) : @@ -221,6 +222,19 @@ void frmEditAccount::LoadSettings( wxString AccNameIn ){ void frmEditAccount::UpdateSettings( wxCommandEvent& event ) { + // Check if server address matches against the blacklist. + // Bring up warning message if it does. + + if (CheckBlacklist(txtAddress->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){ + return; + } + + } + // Update the settings for the account. long itemindex = 0; diff --git a/source/frmNewAccount.cpp b/source/frmNewAccount.cpp index fa8d6b3..49d278e 100644 --- a/source/frmNewAccount.cpp +++ b/source/frmNewAccount.cpp @@ -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; -- 2.39.5