From 150d39e534826091163f061f1be61ec31258a004 Mon Sep 17 00:00:00 2001 From: prozacx Date: Sun, 12 Jun 2005 09:04:05 +0000 Subject: [PATCH] Changed locations of some paths git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@383 726aef4b-f618-498e-8847-2d620e286838 --- User.cpp | 4 ++-- User.h | 10 ++++++++-- znc.cpp | 14 +++++++------- znc.h | 10 +++++----- 4 files changed, 22 insertions(+), 16 deletions(-) diff --git a/User.cpp b/User.cpp index 10aa9b50..6d162769 100644 --- a/User.cpp +++ b/User.cpp @@ -29,6 +29,8 @@ CUser::CUser(const CString& sUserName, CZNC* pZNC) { m_bKeepBuffer = false; m_pZNC->GetManager().AddCron(new CKeepNickTimer(this)); m_pZNC->GetManager().AddCron(new CJoinTimer(this)); + m_sUserPath = m_pZNC->GetUserPath() + "/" + sUserName; + m_sDLPath = GetUserPath() + "/downloads"; } CUser::~CUser() { @@ -520,10 +522,8 @@ bool CUser::ConnectPaused() { } const CString& CUser::GetCurPath() const { return m_pZNC->GetCurPath(); } -const CString& CUser::GetDLPath() const { return m_pZNC->GetDLPath(); } const CString& CUser::GetModPath() const { return m_pZNC->GetModPath(); } const CString& CUser::GetHomePath() const { return m_pZNC->GetHomePath(); } -const CString& CUser::GetDataPath() const { return m_pZNC->GetDataPath(); } CString CUser::GetPemLocation() const { return m_pZNC->GetPemLocation(); } bool CUser::UseClientIP() const { return m_bUseClientIP; } diff --git a/User.h b/User.h index ade1de82..35233d0c 100644 --- a/User.h +++ b/User.h @@ -9,6 +9,7 @@ #include #include #include "Nick.h" +#include "FileUtils.h" using std::vector; using std::set; @@ -99,10 +100,10 @@ public: CString FindModPath(const CString& sModule) const; const CString& GetCurPath() const; - const CString& GetDLPath() const; const CString& GetModPath() const; const CString& GetHomePath() const; - const CString& GetDataPath() const; + const CString& GetUserPath() const { if (!CFile::Exists(m_sUserPath)) { CUtils::MakeDir(m_sUserPath); } return m_sUserPath; } + const CString& GetDLPath() const { if (!CFile::Exists(m_sDLPath)) { CUtils::MakeDir(m_sDLPath); } return m_sDLPath; } CString GetPemLocation() const; bool UseClientIP() const; @@ -139,6 +140,11 @@ protected: CString m_sQuitMsg; CString m_sVersionReply; + // Paths + CString m_sUserPath; + CString m_sDLPath; + // !Paths + bool m_bPassHashed; bool m_bUseClientIP; bool m_bKeepNick; diff --git a/znc.cpp b/znc.cpp index ae8d83d3..27b8b0bd 100644 --- a/znc.cpp +++ b/znc.cpp @@ -245,22 +245,22 @@ void CZNC::InitDirs(const CString& sArgvPath) { m_sZNCPath = m_sHomePath + "/.znc"; // Other dirs that we use - m_sDLPath = m_sZNCPath + "/downloads"; + m_sConfPath = m_sZNCPath + "/configs"; m_sModPath = m_sZNCPath + "/modules"; - m_sDataPath = m_sZNCPath + "/data"; + m_sUserPath = m_sZNCPath + "/users"; } -CString CZNC::GetConfigPath(const CString& sConfigFile) { +CString CZNC::ExpandConfigPath(const CString& sConfigFile) { CString sRetPath; if (sConfigFile.empty()) { - sRetPath = GetZNCPath() + "/znc.conf"; + sRetPath = GetConfPath() + "/znc.conf"; } else { if (sConfigFile.Left(2) == "./" || sConfigFile.Left(3) == "../") { sRetPath = GetCurPath() + "/" + sConfigFile; } else if (sConfigFile.Left(1) != "/") { - sRetPath = GetZNCPath() + "/" + sConfigFile; + sRetPath = GetConfPath() + "/" + sConfigFile; } else { sRetPath = sConfigFile; } @@ -460,7 +460,7 @@ bool CZNC::WriteNewConfig(const CString& sConfig) { } while (CUtils::GetBoolInput("Would you like to setup another user?", false)); // !User - CString sConfigFile = GetConfigPath(sConfig); + CString sConfigFile = ExpandConfigPath(sConfig); CUtils::PrintAction("Writing config [" + sConfigFile + "]"); CFile File(sConfigFile); @@ -490,7 +490,7 @@ bool CZNC::WriteNewConfig(const CString& sConfig) { bool CZNC::ParseConfig(const CString& sConfig) { CString sStatusPrefix; - CString sConfigFile = GetConfigPath(sConfig); + CString sConfigFile = ExpandConfigPath(sConfig); CUtils::PrintAction("Opening Config [" + sConfigFile + "]"); diff --git a/znc.h b/znc.h index 636adbc3..9808cc31 100644 --- a/znc.h +++ b/znc.h @@ -26,7 +26,7 @@ public: bool IsHostAllowed(const CString& sHostMask); void InitDirs(const CString& sArgvPath); bool OnBoot(); - CString GetConfigPath(const CString& sConfigFile); + CString ExpandConfigPath(const CString& sConfigFile); bool WriteNewConfig(const CString& sConfig); static CString GetTag(bool bIncludeVersion = true); CString FindModPath(const CString& sModule) const; @@ -36,11 +36,11 @@ public: CGlobalModules& GetModules() { return *m_pModules; } unsigned short GetListenPort() const { return m_uListenPort; } const CString& GetCurPath() const { if (!CFile::Exists(m_sCurPath)) { CUtils::MakeDir(m_sCurPath); } return m_sCurPath; } - const CString& GetDLPath() const { if (!CFile::Exists(m_sDLPath)) { CUtils::MakeDir(m_sDLPath); } return m_sDLPath; } 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; } const CString& GetZNCPath() const { if (!CFile::Exists(m_sZNCPath)) { CUtils::MakeDir(m_sZNCPath); } return m_sZNCPath; } - const CString& GetDataPath() const { if (!CFile::Exists(m_sDataPath)) { CUtils::MakeDir(m_sDataPath); } return m_sDataPath; } + const CString& GetConfPath() const { if (!CFile::Exists(m_sConfPath)) { CUtils::MakeDir(m_sConfPath); } return m_sConfPath; } + const CString& GetUserPath() const { if (!CFile::Exists(m_sUserPath)) { CUtils::MakeDir(m_sUserPath); } return m_sUserPath; } CString GetPemLocation() const { return GetZNCPath() + "/znc.pem"; } bool IsSSL() const { @@ -66,11 +66,11 @@ protected: TSocketManager m_Manager; CString m_sCurPath; - CString m_sDLPath; CString m_sModPath; CString m_sHomePath; CString m_sZNCPath; - CString m_sDataPath; + CString m_sConfPath; + CString m_sUserPath; CString m_sISpoofFile; CString m_sOrigISpoof;