From 77cb31fe2d31e6ed841377ae766b904e17fc084b Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Fri, 13 Dec 2019 08:36:39 +0000 Subject: [PATCH] Revert "Tweaks for OpenWrt build" --- Common/DDHandler.cpp | 2 - Common/DStarDefines.h | 1 - Common/Defs.h | 1 - Common/Logger.cpp | 30 ++---------- Common/XLXHostsFileDownloader.cpp | 1 - GlobalDefines.h | 30 ------------ Makefile.linux | 70 --------------------------- Makefile.openwrt | 70 --------------------------- Makefile.osx | 70 --------------------------- ircDDBGateway/IRCDDBGatewayAppD.cpp | 8 +-- ircDDBGateway/IRCDDBGatewayDefs.h | 3 +- ircDDBGateway/IRCDDBGatewayThread.cpp | 16 +++--- 12 files changed, 16 insertions(+), 286 deletions(-) delete mode 100644 GlobalDefines.h delete mode 100644 Makefile.linux delete mode 100644 Makefile.openwrt delete mode 100644 Makefile.osx diff --git a/Common/DDHandler.cpp b/Common/DDHandler.cpp index 604babe..faa9a40 100644 --- a/Common/DDHandler.cpp +++ b/Common/DDHandler.cpp @@ -26,10 +26,8 @@ #include #include #include -#if defined(__linux__) #include #include -#endif #include #endif diff --git a/Common/DStarDefines.h b/Common/DStarDefines.h index 5899b0f..b0c3972 100644 --- a/Common/DStarDefines.h +++ b/Common/DStarDefines.h @@ -15,7 +15,6 @@ #define DStarDefines_H #include -#include "../GlobalDefines.h" const unsigned int DSTAR_GMSK_SYMBOL_RATE = 4800U; const float DSTAR_GMSK_BT = 0.5F; diff --git a/Common/Defs.h b/Common/Defs.h index ca9d950..f2c5c31 100644 --- a/Common/Defs.h +++ b/Common/Defs.h @@ -20,7 +20,6 @@ #define Defs_H #include -#include "../GlobalDefines.h" const wxString DEXTRA_HOSTS_FILE_NAME = wxT("DExtra_Hosts.txt"); const wxString DPLUS_HOSTS_FILE_NAME = wxT("DPlus_Hosts.txt"); diff --git a/Common/Logger.cpp b/Common/Logger.cpp index 3747b1b..6aa789b 100644 --- a/Common/Logger.cpp +++ b/Common/Logger.cpp @@ -18,12 +18,6 @@ #include "Logger.h" -#if defined(LOG_LOCALTIME) && LOG_LOCALTIME == 1 -static const bool utc = false; -#else -static const bool utc = true; -#endif - CLogger::CLogger(const wxString& directory, const wxString& name) : wxLog(), m_name(name), @@ -38,12 +32,7 @@ m_day(0) time_t timestamp; ::time(×tamp); - struct tm* tm; - if (utc){ - tm = ::gmtime(×tamp); - }else{ - tm = ::localtime(×tamp); - } + struct tm* tm = ::gmtime(×tamp); wxString text; text.Printf(wxT("%s-%04d-%02d-%02d"), m_name.c_str(), tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday); @@ -85,12 +74,7 @@ void CLogger::DoLogRecord(wxLogLevel level, const wxString& msg, const wxLogReco default: letter = wxT("U"); break; } - struct tm* tm; - if (utc){ - tm = ::gmtime(&info.timestamp); - }else{ - tm = ::localtime(&info.timestamp); - } + struct tm* tm = ::gmtime(&info.timestamp); wxString message; message.Printf(wxT("%s: %04d-%02d-%02d %02d:%02d:%02d: %s\n"), letter.c_str(), tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, msg.c_str()); @@ -107,12 +91,7 @@ void CLogger::writeLog(const wxChar* msg, time_t timestamp) wxASSERT(m_file->IsOpened()); wxASSERT(msg != NULL); - struct tm* tm; - if (utc){ - tm = ::gmtime(×tamp); - }else{ - tm = ::localtime(×tamp); - } + struct tm* tm = ::gmtime(×tamp); int day = tm->tm_yday; if (day != m_day) { @@ -133,4 +112,5 @@ void CLogger::writeLog(const wxChar* msg, time_t timestamp) m_file->Write(wxString(msg)); m_file->Flush(); -} \ No newline at end of file +} + diff --git a/Common/XLXHostsFileDownloader.cpp b/Common/XLXHostsFileDownloader.cpp index 09c6be8..869ddd0 100644 --- a/Common/XLXHostsFileDownloader.cpp +++ b/Common/XLXHostsFileDownloader.cpp @@ -31,7 +31,6 @@ wxString CXLXHostsFileDownloader::Download(const wxString & xlxHostsFileURL) wxLogMessage(_T("Downloading XLX reflector list from %s"), xlxHostsFileURL.c_str()); wxString xlxHostsFileName = wxFileName::CreateTempFileName(_T("XLX_Hosts_")); - wxLogMessage(_T("Downloading XLX host file...")); wxString commandLine = _T("wget -q -O ") + xlxHostsFileName + _T(" ") + xlxHostsFileURL; bool execResult = wxShell(commandLine); diff --git a/GlobalDefines.h b/GlobalDefines.h deleted file mode 100644 index e17c85a..0000000 --- a/GlobalDefines.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef __GLOBAL_DEFS__ -#define __GLOBAL_DEFS__ - -#if defined(__APPLE__) || defined(LINUX) -#define DATA_DIR "/opt/mmdvm/conf/dstar" -#define LOG_DIR "/opt/mmdvm/logs" -#define CONF_DIR "/opt/mmdvm/conf" -#define CONF_FILE "ircDDBGateway.ini" -#define PID_FILE "/tmp/ircDDBGateway.pid" -#define PID_FILE_T "/tmp/ircDDBGateway_%s.pid" - -#elif defined(OPENWRT) && OPENWRT == 1 -#define DATA_DIR "/etc/mmdvm/dstar" -#define LOG_DIR "/var/log/mmdvm" -#define CONF_DIR "/etc" -#define CONF_FILE "ircDDBGateway.ini" -#define PID_FILE "/tmp/ircDDBGateway.pid" -#define PID_FILE_T "/tmp/ircDDBGateway_%s.pid" - -#else -#define DATA_DIR "/usr/share/ircddbgateway" -#define LOG_DIR "/tmp" -#define CONF_DIR "/etc" -#define CONF_FILE "ircddbgateway" -#define PID_FILE "/var/run/ircddbgateway.pid" -#define PID_FILE_T "/var/run/ircddbgateway_%s.pid" - -#endif - -#endif diff --git a/Makefile.linux b/Makefile.linux deleted file mode 100644 index e6be2ea..0000000 --- a/Makefile.linux +++ /dev/null @@ -1,70 +0,0 @@ -export CXX ?= $(shell wx-config --cxx) -export CFLAGS ?= -O2 -Wall $(shell wx-config --cxxflags) -DLOG_LOCALTIME=1 -DLINUX=1 -export GUILIBS ?= $(shell wx-config --libs adv,core,base) -export LIBS ?= $(shell wx-config --libs base) -export LDFLAGS ?= - -all: ircDDBGateway/ircddbgatewayd - -ircDDBGateway/ircddbgatewayd: Common/Common.a ircDDB/IRCDDB.a - $(MAKE) -C ircDDBGateway - -ircDDBGatewayConfig/ircddbgatewayconfig: GUICommon/GUICommon.a Common/Common.a - $(MAKE) -C ircDDBGatewayConfig - -APRSTransmit/aprstransmitd: Common/Common.a - $(MAKE) -C APRSTransmit - -RemoteControl/remotecontrold: Common/Common.a - $(MAKE) -C RemoteControl - -StarNetServer/starnetserverd: Common/Common.a ircDDB/IRCDDB.a - $(MAKE) -C StarNetServer - -TextTransmit/texttransmitd: Common/Common.a - $(MAKE) -C TextTransmit - -TimerControl/timercontrold: Common/Common.a GUICommon/GUICommon.a - $(MAKE) -C TimerControl - -TimeServer/timeserverd: Common/Common.a GUICommon/GUICommon.a - $(MAKE) -C TimeServer - -VoiceTransmit/voicetransmitd: Common/Common.a - $(MAKE) -C VoiceTransmit - -GUICommon/GUICommon.a: - $(MAKE) -C GUICommon - -Common/Common.a: - $(MAKE) -C Common - -ircDDB/IRCDDB.a: - $(MAKE) -C ircDDB - -install: all - $(MAKE) -C Data install - $(MAKE) -C APRSTransmit install - $(MAKE) -C ircDDBGateway install - $(MAKE) -C RemoteControl install - $(MAKE) -C StarNetServer install - $(MAKE) -C TextTransmit install - $(MAKE) -C TimerControl install - $(MAKE) -C TimeServer install - $(MAKE) -C VoiceTransmit install - $(MAKE) -C ircDDBGatewayConfig install - -clean: - $(MAKE) -C Common clean - $(MAKE) -C ircDDB clean - $(MAKE) -C GUICommon clean - $(MAKE) -C APRSTransmit clean - $(MAKE) -C ircDDBGateway clean - $(MAKE) -C RemoteControl clean - $(MAKE) -C StarNetServer clean - $(MAKE) -C TextTransmit clean - $(MAKE) -C TimerControl clean - $(MAKE) -C TimeServer clean - $(MAKE) -C VoiceTransmit clean - $(MAKE) -C ircDDBGatewayConfig clean - diff --git a/Makefile.openwrt b/Makefile.openwrt deleted file mode 100644 index 8e07cf3..0000000 --- a/Makefile.openwrt +++ /dev/null @@ -1,70 +0,0 @@ -# export CXX ?= $(shell wx-config --cxx) -# export CFLAGS ?= -O2 -Wall $(shell wx-config --cxxflags) -# export GUILIBS ?= $(shell wx-config --libs adv,core,base) -# export LIBS ?= $(shell wx-config --libs base) -# export LDFLAGS ?= - -all: ircDDBGateway/ircddbgatewayd - -ircDDBGateway/ircddbgatewayd: Common/Common.a ircDDB/IRCDDB.a - $(MAKE) -C ircDDBGateway - -ircDDBGatewayConfig/ircddbgatewayconfig: GUICommon/GUICommon.a Common/Common.a - $(MAKE) -C ircDDBGatewayConfig - -APRSTransmit/aprstransmitd: Common/Common.a - $(MAKE) -C APRSTransmit - -RemoteControl/remotecontrold: Common/Common.a - $(MAKE) -C RemoteControl - -StarNetServer/starnetserverd: Common/Common.a ircDDB/IRCDDB.a - $(MAKE) -C StarNetServer - -TextTransmit/texttransmitd: Common/Common.a - $(MAKE) -C TextTransmit - -TimerControl/timercontrold: Common/Common.a GUICommon/GUICommon.a - $(MAKE) -C TimerControl - -TimeServer/timeserverd: Common/Common.a GUICommon/GUICommon.a - $(MAKE) -C TimeServer - -VoiceTransmit/voicetransmitd: Common/Common.a - $(MAKE) -C VoiceTransmit - -GUICommon/GUICommon.a: - $(MAKE) -C GUICommon - -Common/Common.a: - $(MAKE) -C Common - -ircDDB/IRCDDB.a: - $(MAKE) -C ircDDB - -install: all - $(MAKE) -C Data install - $(MAKE) -C APRSTransmit install - $(MAKE) -C ircDDBGateway install - $(MAKE) -C RemoteControl install - $(MAKE) -C StarNetServer install - $(MAKE) -C TextTransmit install - $(MAKE) -C TimerControl install - $(MAKE) -C TimeServer install - $(MAKE) -C VoiceTransmit install - $(MAKE) -C ircDDBGatewayConfig install - -clean: - $(MAKE) -C Common clean - $(MAKE) -C ircDDB clean - $(MAKE) -C GUICommon clean - $(MAKE) -C APRSTransmit clean - $(MAKE) -C ircDDBGateway clean - $(MAKE) -C RemoteControl clean - $(MAKE) -C StarNetServer clean - $(MAKE) -C TextTransmit clean - $(MAKE) -C TimerControl clean - $(MAKE) -C TimeServer clean - $(MAKE) -C VoiceTransmit clean - $(MAKE) -C ircDDBGatewayConfig clean - diff --git a/Makefile.osx b/Makefile.osx deleted file mode 100644 index 66755cd..0000000 --- a/Makefile.osx +++ /dev/null @@ -1,70 +0,0 @@ -export CXX ?= $(shell wx-config --cxx) -export CFLAGS ?= -O2 -Wall $(shell wx-config --cxxflags) -DLOG_LOCALTIME=1 -export GUILIBS ?= $(shell wx-config --libs adv,core,base) -export LIBS ?= $(shell wx-config --libs base) -export LDFLAGS ?= - -all: ircDDBGateway/ircddbgatewayd ircDDBGatewayConfig/ircddbgatewayconfig - -ircDDBGateway/ircddbgatewayd: Common/Common.a ircDDB/IRCDDB.a - $(MAKE) -C ircDDBGateway - -ircDDBGatewayConfig/ircddbgatewayconfig: GUICommon/GUICommon.a Common/Common.a - $(MAKE) -C ircDDBGatewayConfig - -APRSTransmit/aprstransmitd: Common/Common.a - $(MAKE) -C APRSTransmit - -RemoteControl/remotecontrold: Common/Common.a - $(MAKE) -C RemoteControl - -StarNetServer/starnetserverd: Common/Common.a ircDDB/IRCDDB.a - $(MAKE) -C StarNetServer - -TextTransmit/texttransmitd: Common/Common.a - $(MAKE) -C TextTransmit - -TimerControl/timercontrold: Common/Common.a GUICommon/GUICommon.a - $(MAKE) -C TimerControl - -TimeServer/timeserverd: Common/Common.a GUICommon/GUICommon.a - $(MAKE) -C TimeServer - -VoiceTransmit/voicetransmitd: Common/Common.a - $(MAKE) -C VoiceTransmit - -GUICommon/GUICommon.a: - $(MAKE) -C GUICommon - -Common/Common.a: - $(MAKE) -C Common - -ircDDB/IRCDDB.a: - $(MAKE) -C ircDDB - -install: all - $(MAKE) -C Data install - $(MAKE) -C APRSTransmit install - $(MAKE) -C ircDDBGateway install - $(MAKE) -C RemoteControl install - $(MAKE) -C StarNetServer install - $(MAKE) -C TextTransmit install - $(MAKE) -C TimerControl install - $(MAKE) -C TimeServer install - $(MAKE) -C VoiceTransmit install - $(MAKE) -C ircDDBGatewayConfig install - -clean: - $(MAKE) -C Common clean - $(MAKE) -C ircDDB clean - $(MAKE) -C GUICommon clean - $(MAKE) -C APRSTransmit clean - $(MAKE) -C ircDDBGateway clean - $(MAKE) -C RemoteControl clean - $(MAKE) -C StarNetServer clean - $(MAKE) -C TextTransmit clean - $(MAKE) -C TimerControl clean - $(MAKE) -C TimeServer clean - $(MAKE) -C VoiceTransmit clean - $(MAKE) -C ircDDBGatewayConfig clean - diff --git a/ircDDBGateway/IRCDDBGatewayAppD.cpp b/ircDDBGateway/IRCDDBGatewayAppD.cpp index 5dcaa61..4ea6d25 100644 --- a/ircDDBGateway/IRCDDBGatewayAppD.cpp +++ b/ircDDBGateway/IRCDDBGatewayAppD.cpp @@ -42,8 +42,6 @@ #include #include -#include "../GlobalDefines.h" - const wxChar* NAME_PARAM = wxT("Gateway Name"); const wxChar* NOLOGGING_SWITCH = wxT("nolog"); const wxChar* DEBUG_SWITCH = wxT("debug"); @@ -124,9 +122,9 @@ int main(int argc, char** argv) wxString pidFileName; if (!name.IsEmpty()) - pidFileName.Printf(wxT(PID_FILE_T), name.c_str()); + pidFileName.Printf(wxT("/var/run/opendv/ircddbgateway_%s.pid"), name.c_str()); else - pidFileName = wxT(PID_FILE); + pidFileName = wxT("/var/run/opendv/ircddbgateway.pid"); pidFileName.Replace(wxT(" "), wxT("_")); char fileName[128U]; @@ -200,7 +198,6 @@ bool CIRCDDBGatewayAppD::init() new wxLogNull; } -#if !defined(OPENWRT) || OPENWRT != 1 wxString appName; if (!m_name.IsEmpty()) appName = APPLICATION_NAME + wxT(" ") + m_name; @@ -214,7 +211,6 @@ bool CIRCDDBGatewayAppD::init() wxLogError(wxT("Another copy of the ircDDB Gateway is running, exiting")); return false; } -#endif wxLogInfo(wxT("Starting ") + APPLICATION_NAME + wxT(" daemon - ") + VERSION); diff --git a/ircDDBGateway/IRCDDBGatewayDefs.h b/ircDDBGateway/IRCDDBGatewayDefs.h index 7806c3b..9eac8a0 100644 --- a/ircDDBGateway/IRCDDBGatewayDefs.h +++ b/ircDDBGateway/IRCDDBGatewayDefs.h @@ -20,11 +20,10 @@ #define IRCDDBGatewayDefs_H #include -#include "../GlobalDefines.h" const wxString APPLICATION_NAME = wxT("ircDDB Gateway"); -const wxString CONFIG_FILE_NAME = wxT(CONF_FILE); +const wxString CONFIG_FILE_NAME = wxT("ircddbgateway"); const wxString STATUS1_FILE_NAME = wxT("status1.txt"); const wxString STATUS2_FILE_NAME = wxT("status2.txt"); diff --git a/ircDDBGateway/IRCDDBGatewayThread.cpp b/ircDDBGateway/IRCDDBGatewayThread.cpp index 301bc4e..37b8b59 100644 --- a/ircDDBGateway/IRCDDBGatewayThread.cpp +++ b/ircDDBGateway/IRCDDBGatewayThread.cpp @@ -693,19 +693,19 @@ void CIRCDDBGatewayThread::processIrcDDB() case 0: case 10: if (m_lastStatus != IS_DISCONNECTED) { - wxLogMessage(wxT("Disconnected from ircDDB")); + wxLogInfo(wxT("Disconnected from ircDDB")); m_lastStatus = IS_DISCONNECTED; } break; case 7: if (m_lastStatus != IS_CONNECTED) { - wxLogMessage(wxT("Connected to ircDDB")); + wxLogInfo(wxT("Connected to ircDDB")); m_lastStatus = IS_CONNECTED; } break; default: if (m_lastStatus != IS_CONNECTING) { - wxLogMessage(wxT("Connecting to ircDDB")); + wxLogInfo(wxT("Connecting to ircDDB")); m_lastStatus = IS_CONNECTING; } break; @@ -726,13 +726,13 @@ void CIRCDDBGatewayThread::processIrcDDB() break; if (!address.IsEmpty()) { - wxLogInfo(wxT("USER: %s %s %s %s"), user.c_str(), repeater.c_str(), gateway.c_str(), address.c_str()); + wxLogMessage(wxT("USER: %s %s %s %s"), user.c_str(), repeater.c_str(), gateway.c_str(), address.c_str()); m_cache.updateUser(user, repeater, gateway, address, timestamp, DP_DEXTRA, false, false); #if defined(ENABLE_NAT_TRAVERSAL) m_natTraversal->traverseNatG2(address); #endif } else { - wxLogInfo(wxT("USER: %s NOT FOUND"), user.c_str()); + wxLogMessage(wxT("USER: %s NOT FOUND"), user.c_str()); } } break; @@ -745,7 +745,7 @@ void CIRCDDBGatewayThread::processIrcDDB() CRepeaterHandler::resolveRepeater(repeater, gateway, address, DP_DEXTRA); if (!address.IsEmpty()) { - wxLogInfo(wxT("REPEATER: %s %s %s"), repeater.c_str(), gateway.c_str(), address.c_str()); + wxLogMessage(wxT("REPEATER: %s %s %s"), repeater.c_str(), gateway.c_str(), address.c_str()); m_cache.updateRepeater(repeater, gateway, address, DP_DEXTRA, false, false); #if defined(ENABLE_NAT_TRAVERSAL) m_natTraversal->traverseNatG2(address); @@ -765,7 +765,7 @@ void CIRCDDBGatewayThread::processIrcDDB() CDExtraHandler::gatewayUpdate(gateway, address); CDPlusHandler::gatewayUpdate(gateway, address); if (!address.IsEmpty()) { - wxLogInfo(wxT("GATEWAY: %s %s"), gateway.c_str(), address.c_str()); + wxLogMessage(wxT("GATEWAY: %s %s"), gateway.c_str(), address.c_str()); m_cache.updateGateway(gateway, address, DP_DEXTRA, false, false); #if defined(ENABLE_NAT_TRAVERSAL) m_natTraversal->traverseNatG2(address); @@ -812,7 +812,7 @@ void CIRCDDBGatewayThread::processRepeater(IRepeaterProtocolHandler* handler) if (!repeater.IsSameAs(user)) { CRepeaterHandler* handler = CRepeaterHandler::findDVRepeater(repeater); if (handler == NULL) - wxLogInfo(wxT("Heard received from unknown repeater, %s"), repeater.c_str()); + wxLogMessage(wxT("Heard received from unknown repeater, %s"), repeater.c_str()); else handler->processRepeater(*heard);