Remove flawed Add/Del/List/BindHost(s) (close #983)

This commit is contained in:
J-P Nurmi
2015-08-17 15:22:20 +02:00
parent 6bfe7d840f
commit d19a040f2d
8 changed files with 28 additions and 314 deletions
+11 -44
View File
@@ -510,10 +510,6 @@ bool CZNC::WriteConfig() {
config.AddKeyValuePair("Motd", sLine.FirstLine());
}
for (const CString& sHost : m_vsBindHosts) {
config.AddKeyValuePair("BindHost", sHost.FirstLine());
}
for (const CString& sProxy : m_vsTrustedProxies) {
config.AddKeyValuePair("TrustedProxy", sProxy.FirstLine());
}
@@ -1059,10 +1055,17 @@ bool CZNC::LoadGlobal(CConfig& config, CString& sError) {
AddMotd(sMotd);
}
m_vsBindHosts.clear();
config.FindStringVector("bindhost", vsList);
for (const CString& sHost : vsList) {
AddBindHost(sHost);
if (config.FindStringVector("bindhost", vsList)) {
CUtils::PrintStatus(false, "WARNING: the global BindHost list is deprecated. Ignoring the following lines:");
for (const CString& sHost : vsList) {
CUtils::PrintStatus(false, "BindHost = " + sHost);
}
}
if (config.FindStringVector("vhost", vsList)) {
CUtils::PrintStatus(false, "WARNING: the global vHost list is deprecated. Ignoring the following lines:");
for (const CString& sHost : vsList) {
CUtils::PrintStatus(false, "vHost = " + sHost);
}
}
m_vsTrustedProxies.clear();
@@ -1071,11 +1074,6 @@ bool CZNC::LoadGlobal(CConfig& config, CString& sError) {
AddTrustedProxy(sProxy);
}
config.FindStringVector("vhost", vsList);
for (const CString& sHost : vsList) {
AddBindHost(sHost);
}
CString sVal;
if (config.FindStringEntry("pidfile", sVal))
m_sPidFile = sVal;
@@ -1277,37 +1275,6 @@ void CZNC::DumpConfig(const CConfig* pConfig) {
}
}
void CZNC::ClearBindHosts() {
m_vsBindHosts.clear();
}
bool CZNC::AddBindHost(const CString& sHost) {
if (sHost.empty()) {
return false;
}
for (const CString& sBindHost : m_vsBindHosts) {
if (sBindHost.Equals(sHost)) {
return false;
}
}
m_vsBindHosts.push_back(sHost);
return true;
}
bool CZNC::RemBindHost(const CString& sHost) {
VCString::iterator it;
for (it = m_vsBindHosts.begin(); it != m_vsBindHosts.end(); ++it) {
if (sHost.Equals(*it)) {
m_vsBindHosts.erase(it);
return true;
}
}
return false;
}
void CZNC::ClearTrustedProxies() {
m_vsTrustedProxies.clear();
}