mirror of
https://github.com/znc/znc.git
synced 2026-08-07 17:33:34 +02:00
Added global vhosts and getters/setters for ISpoof*
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@453 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
@@ -324,6 +324,10 @@ bool CZNC::WriteConfig() {
|
||||
if (!m_sPidFile.empty()) { File.Write("PidFile = " + m_sPidFile + "\r\n"); }
|
||||
if (!m_sStatusPrefix.empty()) { File.Write("StatusPrefix = " + m_sStatusPrefix + "\r\n"); }
|
||||
|
||||
for (unsigned int v = 0; v < m_vsVHosts.size(); v++) {
|
||||
File.Write("VHost = " + m_vsVHosts[v] + "\r\n");
|
||||
}
|
||||
|
||||
#ifdef _MODULES
|
||||
CGlobalModules& Mods = GetModules();
|
||||
|
||||
@@ -975,6 +979,9 @@ bool CZNC::ParseConfig(const CString& sConfig) {
|
||||
} else if (sName.CaseCmp("ISpoofFile") == 0) {
|
||||
m_sISpoofFile = sValue;
|
||||
continue;
|
||||
} else if (sName.CaseCmp("VHost") == 0) {
|
||||
AddVHost(sValue);
|
||||
continue;
|
||||
} else if (sName.CaseCmp("PidFile") == 0) {
|
||||
if (!sValue.empty() && sValue[0] != '/') {
|
||||
m_sPidFile = GetZNCPath() + "/" + sValue;
|
||||
@@ -1008,6 +1015,22 @@ bool CZNC::ParseConfig(const CString& sConfig) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CZNC::AddVHost(const CString& sHost) {
|
||||
for (unsigned int a = 0; a < m_vsVHosts.size(); a++) {
|
||||
if (m_vsVHosts[a].CaseCmp(sHost) == 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
m_vsVHosts.push_back(sHost);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CZNC::RemVHost(const CString& sHost) {
|
||||
// @todo
|
||||
return true;
|
||||
}
|
||||
|
||||
CString CZNC::FindModPath(const CString& sModule) const {
|
||||
CString sModPath = GetCurPath() + "/modules/" + sModule;
|
||||
sModPath += (sModule.find(".") == CString::npos) ? ".so" : "";
|
||||
|
||||
@@ -35,6 +35,13 @@ public:
|
||||
bool WriteConfig();
|
||||
static CString GetTag(bool bIncludeVersion = true);
|
||||
CString FindModPath(const CString& sModule) const;
|
||||
bool AddVHost(const CString& sHost);
|
||||
bool RemVHost(const CString& sHost);
|
||||
|
||||
// Setters
|
||||
void SetISpoofFile(const CString& s) { m_sISpoofFile = s; }
|
||||
void SetISpoofFormat(const CString& s) { m_sISpoofFormat = s; }
|
||||
// !Setters
|
||||
|
||||
// Getters
|
||||
TSocketManager<Csock>& GetManager() { return m_Manager; }
|
||||
@@ -50,6 +57,9 @@ public:
|
||||
const CString& GetConfBackupPath() const { if (!CFile::Exists(m_sConfBackupPath)) { CUtils::MakeDir(m_sConfBackupPath); } return m_sConfBackupPath; }
|
||||
const CString& GetUserPath() const { if (!CFile::Exists(m_sUserPath)) { CUtils::MakeDir(m_sUserPath); } return m_sUserPath; }
|
||||
CString GetPemLocation() const { return GetZNCPath() + "/znc.pem"; }
|
||||
const CString& GetISpoofFile() const { return m_sISpoofFile; }
|
||||
const CString& GetISpoofFormat() const { return m_sISpoofFormat; }
|
||||
const VCString& GetVHosts() const { return m_vsVHosts; }
|
||||
|
||||
bool IsSSL() const {
|
||||
#ifdef HAVE_LIBSSL
|
||||
@@ -91,6 +101,7 @@ protected:
|
||||
CString m_sOrigISpoof;
|
||||
CString m_sISpoofFormat;
|
||||
CString m_sPidFile;
|
||||
VCString m_vsVHosts;
|
||||
CLockFile m_LockFile;
|
||||
bool m_bISpoofLocked;
|
||||
bool m_bSSL;
|
||||
|
||||
Reference in New Issue
Block a user