From 784b0f1f7c866f1596f3f163e3f8d28d258327da Mon Sep 17 00:00:00 2001 From: Geoffrey Merck Date: Thu, 12 Mar 2020 21:20:45 +0100 Subject: [PATCH] Add audio parameters to config --- SGSXLConfig.cpp | 13 +++++++++++-- SGSXLConfig.h | 8 ++++++-- example.cfg | 8 +++++++- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/SGSXLConfig.cpp b/SGSXLConfig.cpp index a0f06c3..8b7cfb6 100644 --- a/SGSXLConfig.cpp +++ b/SGSXLConfig.cpp @@ -27,7 +27,6 @@ CSGSXLConfig::CSGSXLConfig(const std::string &pathname) { - if (pathname.size() < 1) { printf("Configuration filename too short!\n"); return; @@ -159,7 +158,7 @@ CSGSXLConfig::CSGSXLConfig(const std::string &pathname) key.str("");key.clear(); key << "module.[" << i << "].info"; - get_value(cfg, key.str(), pmod->info, 0, 20, "Smart Group Server"); + get_value(cfg, key.str(), pmod->info, 0, 20, "Smart Group Server XL"); if (pmod->info.size()) pmod->info.resize(20, ' '); @@ -215,6 +214,16 @@ CSGSXLConfig::CSGSXLConfig(const std::string &pathname) m_remotePassword.empty(); printf("Remote disabled\n"); } + + //audio + get_value(cfg, "audio.enabled", m_audioEnabled, true); + get_value(cfg, "audio.directory", m_audioDirectory, 0, 2000, ""); + m_audioDirectory = std::string(DATA_DIR) + "/" + m_audioDirectory; + if(m_audioEnabled) { + printf("Audio enabled, auudio directory : %s", m_audioDirectory.c_str()); + } else { + printf("Audio disabled"); + } } CSGSXLConfig::~CSGSXLConfig() diff --git a/SGSXLConfig.h b/SGSXLConfig.h index 12da732..9146582 100644 --- a/SGSXLConfig.h +++ b/SGSXLConfig.h @@ -56,6 +56,8 @@ public: void getRemote(bool &enabled, std::string &password, unsigned int &port) const; + void getAudio(bool & enabled, std::string &audioDir) const; + unsigned int getModCount(); unsigned int getLinkCount(const char *type); unsigned int getIrcDDBCount(); @@ -74,5 +76,7 @@ private: bool m_remoteEnabled; std::string m_remotePassword; unsigned int m_remotePort; -} -; + + bool m_audioEnabled; + std::string m_audioDirectory; +}; diff --git a/example.cfg b/example.cfg index fbb3300..8242558 100644 --- a/example.cfg +++ b/example.cfg @@ -7,8 +7,14 @@ gateway = { # address = "" # this is the computer interface for the outgoing connection. Usually leave it blank and it will use whatever is avaiable. } -# NOTHING usually needs to be specified in the ircddb section +audio = { + enabled = true +# The directory containing audio files for announcement. This is relative to DATADIR (see Makefile). It is case senstitive + directory = "en_GB" +} +# NOTHING usually needs to be specified in the ircddb section, quadnet is the default network. To make you groups available on more than Quadnet +# you have to specify all the networks you want including QuadNet ircddb = ( #ircddb networks in paretheses # { # hostname = "rr.openquad.net"