From 0fff5f489c4ef8133395a475ff0840489e33f2a1 Mon Sep 17 00:00:00 2001 From: Geoffrey Merck F4FXL - KC3FRA Date: Thu, 18 Apr 2019 08:18:37 +0200 Subject: [PATCH 1/5] Add XLX URL Validation under windows. Fix empty string always returned for XLX URL --- GUICommon/XLXSet.cpp | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/GUICommon/XLXSet.cpp b/GUICommon/XLXSet.cpp index d1497e1..0cfd75b 100644 --- a/GUICommon/XLXSet.cpp +++ b/GUICommon/XLXSet.cpp @@ -20,6 +20,8 @@ #include "XLXSet.h" #include "Defs.h" +#include + // TODO F4FXL try to figure out why below symbols are not found under ubuntu //#include @@ -79,13 +81,17 @@ bool CXLXSet::Validate() if (n == wxNOT_FOUND) return false; +#if defined(__WINDOWS__) // TODO F4FXL try to figure out why below symbols are not found under ubuntu - /*wxString value = m_xlxHostsFileUrl->GetValue(); + wxString value = m_xlxHostsFileUrl->GetValue(); wxURL url(value); - if (url.GetError() != wxURL_NOERR) - return false;*/ + if (url.GetError() == wxURL_NOERR) + return true; + return false; +#else return true; +#endif } @@ -102,13 +108,16 @@ wxString CXLXSet::getXLXHostsFileUrl() const { wxString value = m_xlxHostsFileUrl->GetValue(); - +#if defined(__WINDOWS__) // TODO F4FXL try to figure out why below symbols are not found under ubuntu - //wxURL url(value); - //if (url.GetError() == wxURL_NOERR) - // return value; - + wxURL url(value); + if (url.GetError() == wxURL_NOERR) + return value; + return wxEmptyString; +#else + return value; +#endif } void CXLXSet::onEnabled(wxCommandEvent &event) From 87e1a31e7d8dc361b77a99688c28b44d7319ad7e Mon Sep 17 00:00:00 2001 From: Geoffrey Merck F4FXL - KC3FRA Date: Thu, 18 Apr 2019 08:20:27 +0200 Subject: [PATCH 2/5] Pi-Star puts a blank for empty values in config files, this breaks default value handling. Implement a work around for XLX URL. Should this be rather addressed on pi-star end ? --- Common/IRCDDBGatewayConfig.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Common/IRCDDBGatewayConfig.cpp b/Common/IRCDDBGatewayConfig.cpp index a84b4ce..e796555 100644 --- a/Common/IRCDDBGatewayConfig.cpp +++ b/Common/IRCDDBGatewayConfig.cpp @@ -760,7 +760,7 @@ m_y(DEFAULT_WINDOW_Y) m_config->Read(m_name + KEY_XLX_ENABLED, &m_xlxEnabled, DEFAULT_XLX_ENABLED); m_config->Read(m_name + KEY_XLX_HOSTS_FILE_URL, &m_xlxHostsFileUrl, DEFAULT_XLX_HOSTS_FILE_URL); - if(m_xlxEnabled && m_xlxHostsFileUrl.IsEmpty())//To avoid support nightmare, fill the url with the default one when xlx is enabled and the url is left empty + if(m_xlxEnabled && m_xlxHostsFileUrl.Trim().IsEmpty())//To avoid support nightmare, fill the url with the default one when xlx is enabled and the url is left empty m_xlxHostsFileUrl = DEFAULT_XLX_HOSTS_FILE_URL; m_config->Read(m_name + KEY_STARNET_BAND1, &m_starNet1Band, DEFAULT_STARNET_BAND); @@ -1434,7 +1434,7 @@ m_y(DEFAULT_WINDOW_Y) } else if (key.IsSameAs(KEY_XLX_ENABLED)) { val.ToLong(&temp1); m_xlxEnabled = temp1 == 1L; - } else if (key.IsSameAs(KEY_XLX_HOSTS_FILE_URL) && !val.IsEmpty()) { //always load default url if the value in the config file is empty + } else if (key.IsSameAs(KEY_XLX_HOSTS_FILE_URL) && !val.Trim().IsEmpty()) { //always load default url if the value in the config file is empty m_xlxHostsFileUrl = val; } else if (key.IsSameAs(KEY_STARNET_BAND1)) { m_starNet1Band = val; From 9ab2841100c7c2c6d8073abdc6eb322af319818c Mon Sep 17 00:00:00 2001 From: Geoffrey Merck F4FXL - KC3FRA Date: Thu, 18 Apr 2019 14:35:46 +0200 Subject: [PATCH 3/5] Add error message on invalid XLX URL --- GUICommon/XLXSet.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/GUICommon/XLXSet.cpp b/GUICommon/XLXSet.cpp index 0cfd75b..7d04f98 100644 --- a/GUICommon/XLXSet.cpp +++ b/GUICommon/XLXSet.cpp @@ -88,6 +88,8 @@ bool CXLXSet::Validate() if (url.GetError() == wxURL_NOERR) return true; + wxMessageDialog dialog(this, _("The XLX host file URL is not valid"), m_title + _(" Error"), wxICON_ERROR); + dialog.ShowModal(); return false; #else return true; From f7bf375bea5740897651aceef9e26c39e957aabc Mon Sep 17 00:00:00 2001 From: Geoffrey Merck F4FXL - KC3FRA Date: Fri, 19 Apr 2019 08:27:47 +0200 Subject: [PATCH 4/5] Fix segmentaton fault on exit --- ircDDBGateway/IRCDDBGatewayApp.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ircDDBGateway/IRCDDBGatewayApp.cpp b/ircDDBGateway/IRCDDBGatewayApp.cpp index 3b03695..1101563 100644 --- a/ircDDBGateway/IRCDDBGatewayApp.cpp +++ b/ircDDBGateway/IRCDDBGatewayApp.cpp @@ -171,8 +171,10 @@ int CIRCDDBGatewayApp::OnExit() wxLogInfo(APPLICATION_NAME + wxT(" is exiting")); - //m_thread->kill(); - wxGetApp().GetTopWindow()->Close(); + m_thread->kill(); + wxWindow * topWin = wxGetApp().GetTopWindow(); + if (topWin != NULL) + topWin->Close(); delete m_config; From 387f8750582bd1f037487522afc9d7536f03bfda Mon Sep 17 00:00:00 2001 From: Geoffrey Merck Date: Sun, 21 Apr 2019 08:41:23 +0200 Subject: [PATCH 5/5] Fix C4706 warning --- Common/XLXHostsFileDownloader.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Common/XLXHostsFileDownloader.cpp b/Common/XLXHostsFileDownloader.cpp index 438e770..869ddd0 100644 --- a/Common/XLXHostsFileDownloader.cpp +++ b/Common/XLXHostsFileDownloader.cpp @@ -66,8 +66,8 @@ wxString CXLXHostsFileDownloader::Download(const wxString & xlxHostsFileURL) return wxEmptyString; } - wxInputStream* in = NULL; - if((in = http.GetInputStream(path)) && in->IsOk()) { + wxInputStream* in = http.GetInputStream(path); + if(in != NULL && in->IsOk()) { wxFile file; wxString xlxHostsFileName = wxFileName::CreateTempFileName(_T("XLX_Hosts_"), &file); wxLogMessage(_T("Created temporary file %s"), xlxHostsFileName);