From 7cb1d2f95883e0a76b1f75fb9dfffbdadbefd370 Mon Sep 17 00:00:00 2001 From: prozacx Date: Tue, 2 Aug 2005 17:44:46 +0000 Subject: [PATCH] Added some helper functions git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@455 726aef4b-f618-498e-8847-2d620e286838 --- znc.cpp | 10 +++++++++- znc.h | 5 ++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/znc.cpp b/znc.cpp index bd6a0921..e3063b58 100644 --- a/znc.cpp +++ b/znc.cpp @@ -19,7 +19,7 @@ CZNC::CZNC() { #endif m_uListenPort = 0; m_bISpoofLocked = false; - m_sISpoofFormat = "global { reply \"%\" }"; + SetISpoofFormat(""); // Set ISpoofFormat to default } CZNC::~CZNC() { @@ -1015,7 +1015,15 @@ bool CZNC::ParseConfig(const CString& sConfig) { return true; } +void CZNC::ClearVHosts() { + m_vsVHosts.clear(); +} + bool CZNC::AddVHost(const CString& sHost) { + if (sHost.empty()) { + return false; + } + for (unsigned int a = 0; a < m_vsVHosts.size(); a++) { if (m_vsVHosts[a].CaseCmp(sHost) == 0) { return false; diff --git a/znc.h b/znc.h index 609229cf..b9e0f6a4 100644 --- a/znc.h +++ b/znc.h @@ -35,12 +35,14 @@ public: bool WriteConfig(); static CString GetTag(bool bIncludeVersion = true); CString FindModPath(const CString& sModule) const; + void ClearVHosts(); bool AddVHost(const CString& sHost); bool RemVHost(const CString& sHost); // Setters + void SetStatusPrefix(const CString& s) { m_sStatusPrefix = (s.empty()) ? "*" : s; } void SetISpoofFile(const CString& s) { m_sISpoofFile = s; } - void SetISpoofFormat(const CString& s) { m_sISpoofFormat = s; } + void SetISpoofFormat(const CString& s) { m_sISpoofFormat = (s.empty()) ? "global { reply \"%\" }" : s; } // !Setters // Getters @@ -49,6 +51,7 @@ public: CGlobalModules& GetModules() { return *m_pModules; } #endif unsigned short GetListenPort() const { return m_uListenPort; } + const CString& GetStatusPrefix() const { return m_sStatusPrefix; } const CString& GetCurPath() const { if (!CFile::Exists(m_sCurPath)) { CUtils::MakeDir(m_sCurPath); } return m_sCurPath; } const CString& GetModPath() const { if (!CFile::Exists(m_sModPath)) { CUtils::MakeDir(m_sModPath); } return m_sModPath; } const CString& GetHomePath() const { if (!CFile::Exists(m_sHomePath)) { CUtils::MakeDir(m_sHomePath); } return m_sHomePath; }