mirror of
https://github.com/oe7drt/YSFClients.git
synced 2026-04-07 15:24:00 +00:00
Add a rudimentary block list.
This commit is contained in:
parent
1d428e921d
commit
c159461f30
10 changed files with 269 additions and 34 deletions
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2015,2016,2020 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2015,2016,2020,2021 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
|
||||
|
|
@ -31,7 +31,8 @@ enum SECTION {
|
|||
SECTION_GENERAL,
|
||||
SECTION_INFO,
|
||||
SECTION_LOG,
|
||||
SECTION_NETWORK
|
||||
SECTION_NETWORK,
|
||||
SECTION_BLOCKLIST
|
||||
};
|
||||
|
||||
CConf::CConf(const std::string& file) :
|
||||
|
|
@ -46,7 +47,9 @@ m_logFilePath(),
|
|||
m_logFileRoot(),
|
||||
m_logFileRotate(true),
|
||||
m_networkPort(0U),
|
||||
m_networkDebug(false)
|
||||
m_networkDebug(false),
|
||||
m_blockListFile(),
|
||||
m_blockListTime(5U)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -78,6 +81,8 @@ bool CConf::read()
|
|||
section = SECTION_LOG;
|
||||
else if (::strncmp(buffer, "[Network]", 9U) == 0)
|
||||
section = SECTION_NETWORK;
|
||||
else if (::strncmp(buffer, "[Block List]", 12U) == 0)
|
||||
section = SECTION_BLOCKLIST;
|
||||
else
|
||||
section = SECTION_NONE;
|
||||
|
||||
|
|
@ -135,6 +140,11 @@ bool CConf::read()
|
|||
m_networkPort = (unsigned int)::atoi(value);
|
||||
else if (::strcmp(key, "Debug") == 0)
|
||||
m_networkDebug = ::atoi(value) == 1;
|
||||
} else if (section == SECTION_BLOCKLIST) {
|
||||
if (::strcmp(key, "File") == 0)
|
||||
m_blockListFile = value;
|
||||
else if (::strcmp(key, "Time") == 0)
|
||||
m_blockListTime = (unsigned int)::atoi(value);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -198,3 +208,12 @@ bool CConf::getNetworkDebug() const
|
|||
return m_networkDebug;
|
||||
}
|
||||
|
||||
std::string CConf::getBlockListFile() const
|
||||
{
|
||||
return m_blockListFile;
|
||||
}
|
||||
|
||||
unsigned int CConf::getBlockListTime() const
|
||||
{
|
||||
return m_blockListTime;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue