diff --git a/YSFGateway/Conf.cpp b/YSFGateway/Conf.cpp index 7566783..7cb71ca 100644 --- a/YSFGateway/Conf.cpp +++ b/YSFGateway/Conf.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015,2016,2017,2018 by Jonathan Naylor G4KLX + * Copyright (C) 2015-2019 by Jonathan Naylor G4KLX * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -47,6 +47,7 @@ m_rptAddress(), m_rptPort(0U), m_myAddress(), m_myPort(0U), +m_wiresXMakeUpper(true), m_daemon(false), m_rxFrequency(0U), m_txFrequency(0U), @@ -159,6 +160,8 @@ bool CConf::read() m_myAddress = value; else if (::strcmp(key, "LocalPort") == 0) m_myPort = (unsigned int)::atoi(value); + else if (::strcmp(key, "WiresXMakeUpper") == 0) + m_wiresXMakeUpper = ::atoi(value) == 1; else if (::strcmp(key, "Daemon") == 0) m_daemon = ::atoi(value) == 1; } else if (section == SECTION_INFO) { @@ -291,6 +294,11 @@ unsigned int CConf::getMyPort() const return m_myPort; } +bool CConf::getWiresXMakeUpper() const +{ + return m_wiresXMakeUpper; +} + bool CConf::getDaemon() const { return m_daemon; diff --git a/YSFGateway/Conf.h b/YSFGateway/Conf.h index 8a1a6f5..7ab7ea6 100644 --- a/YSFGateway/Conf.h +++ b/YSFGateway/Conf.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015,2016,2017,2018 by Jonathan Naylor G4KLX + * Copyright (C) 2015-2019 by Jonathan Naylor G4KLX * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -37,6 +37,7 @@ public: unsigned int getRptPort() const; std::string getMyAddress() const; unsigned int getMyPort() const; + bool getWiresXMakeUpper() const; bool getDaemon() const; // The Info section @@ -102,6 +103,7 @@ private: unsigned int m_rptPort; std::string m_myAddress; unsigned int m_myPort; + bool m_wiresXMakeUpper; bool m_daemon; unsigned int m_rxFrequency; diff --git a/YSFGateway/YSFGateway.cpp b/YSFGateway/YSFGateway.cpp index 5b9d9c5..fe50af0 100644 --- a/YSFGateway/YSFGateway.cpp +++ b/YSFGateway/YSFGateway.cpp @@ -1,5 +1,5 @@ /* -* Copyright (C) 2016,2017,2018 by Jonathan Naylor G4KLX +* Copyright (C) 2016-2019 by Jonathan Naylor G4KLX * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -233,8 +233,9 @@ int CYSFGateway::run() std::string fileName = m_conf.getYSFNetworkHosts(); unsigned int reloadTime = m_conf.getYSFNetworkReloadTime(); + bool wiresXMakeUpper = m_conf.getWiresXMakeUpper(); - m_reflectors = new CYSFReflectors(fileName, reloadTime); + m_reflectors = new CYSFReflectors(fileName, reloadTime, wiresXMakeUpper); m_reflectors->reload(); createWiresX(&rptNetwork); diff --git a/YSFGateway/YSFGateway.ini b/YSFGateway/YSFGateway.ini index 0cb1b20..e83a3bb 100644 --- a/YSFGateway/YSFGateway.ini +++ b/YSFGateway/YSFGateway.ini @@ -7,6 +7,7 @@ RptAddress=127.0.0.1 RptPort=3200 LocalAddress=127.0.0.1 LocalPort=4200 +WiresXMakeUpper=1 Daemon=0 [Info] diff --git a/YSFGateway/YSFReflectors.cpp b/YSFGateway/YSFReflectors.cpp index 5325fab..cbfd54b 100644 --- a/YSFGateway/YSFReflectors.cpp +++ b/YSFGateway/YSFReflectors.cpp @@ -1,5 +1,5 @@ /* -* Copyright (C) 2016,2017,2018 by Jonathan Naylor G4KLX +* Copyright (C) 2016-2019 by Jonathan Naylor G4KLX * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -26,7 +26,7 @@ #include #include -CYSFReflectors::CYSFReflectors(const std::string& hostsFile, unsigned int reloadTime) : +CYSFReflectors::CYSFReflectors(const std::string& hostsFile, unsigned int reloadTime, bool makeUpper) : m_hostsFile(hostsFile), m_parrotAddress(), m_parrotPort(0U), @@ -40,6 +40,7 @@ m_fcsRooms(), m_newReflectors(), m_currReflectors(), m_search(), +m_makeUpper(makeUpper), m_timer(1000U, reloadTime * 60U) { if (reloadTime > 0U) @@ -243,6 +244,13 @@ bool CYSFReflectors::load() if (size == 0U) return false; + if (m_makeUpper) { + for (std::vector::iterator it = m_newReflectors.begin(); it != m_newReflectors.end(); ++it) { + std::transform((*it)->m_name.begin(), (*it)->m_name.end(), (*it)->m_name.begin(), ::toupper); + std::transform((*it)->m_desc.begin(), (*it)->m_desc.end(), (*it)->m_desc.begin(), ::toupper); + } + } + std::sort(m_newReflectors.begin(), m_newReflectors.end(), refComparison); return true; diff --git a/YSFGateway/YSFReflectors.h b/YSFGateway/YSFReflectors.h index cbbdeb7..b52092b 100644 --- a/YSFGateway/YSFReflectors.h +++ b/YSFGateway/YSFReflectors.h @@ -1,5 +1,5 @@ /* -* Copyright (C) 2016,2017,2018 by Jonathan Naylor G4KLX +* Copyright (C) 2016-2019 by Jonathan Naylor G4KLX * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -54,7 +54,7 @@ public: class CYSFReflectors { public: - CYSFReflectors(const std::string& hostsFile, unsigned int reloadTime); + CYSFReflectors(const std::string& hostsFile, unsigned int reloadTime, bool makeUpper); ~CYSFReflectors(); void setParrot(const std::string& address, unsigned int port); @@ -90,6 +90,7 @@ private: std::vector m_newReflectors; std::vector m_currReflectors; std::vector m_search; + bool m_makeUpper; CTimer m_timer; };