Upgrading to CZNC::Get()

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@508 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
prozacx
2005-09-19 04:09:37 +00:00
parent ba951747f9
commit 89e5079ce9
13 changed files with 100 additions and 139 deletions

View File

@@ -6,6 +6,7 @@
#include "Chan.h"
#include "Utils.h"
#include "FileUtils.h"
#include "znc.h"
#include <sys/wait.h>
// Forward Declaration
@@ -87,7 +88,7 @@ public:
class CShellMod : public CModule {
public:
MODCONSTRUCTOR(CShellMod) {
m_sPath = pUser->GetHomePath();
m_sPath = CZNC::Get().GetHomePath();
}
virtual ~CShellMod() {
@@ -100,7 +101,7 @@ public:
virtual void OnModCommand(const CString& sCommand) {
if ((strcasecmp(sCommand.c_str(), "cd") == 0) || (strncasecmp(sCommand.c_str(), "cd ", 3) == 0)) {
CString sPath = CUtils::ChangeDir(m_sPath, ((sCommand.length() == 2) ? CString(m_pUser->GetHomePath()) : CString(sCommand.substr(3))), m_pUser->GetHomePath());
CString sPath = CUtils::ChangeDir(m_sPath, ((sCommand.length() == 2) ? CString(CZNC::Get().GetHomePath()) : CString(sCommand.substr(3))), CZNC::Get().GetHomePath());
CFile Dir(sPath);
if (Dir.IsDir()) {
@@ -119,7 +120,7 @@ public:
if ((sToNick.empty()) || (sFile.empty())) {
PutShell("usage: Send <nick> <file>");
} else {
sFile = CUtils::ChangeDir(m_sPath, sFile, m_pUser->GetHomePath());
sFile = CUtils::ChangeDir(m_sPath, sFile, CZNC::Get().GetHomePath());
if (!CFile::Exists(sFile)) {
PutShell("get: no such file [" + sFile + "]");
@@ -135,7 +136,7 @@ public:
if (sFile.empty()) {
PutShell("usage: Get <file>");
} else {
sFile = CUtils::ChangeDir(m_sPath, sFile, m_pUser->GetHomePath());
sFile = CUtils::ChangeDir(m_sPath, sFile, CZNC::Get().GetHomePath());
if (!CFile::Exists(sFile)) {
PutShell("get: no such file [" + sFile + "]");
@@ -161,7 +162,7 @@ public:
virtual EModRet OnDCCUserSend(const CNick& RemoteNick, unsigned long uLongIP, unsigned short uPort, const CString& sFile, unsigned long uFileSize) {
if (strcasecmp(RemoteNick.GetNick().c_str(), CString(GetModNick()).c_str()) == 0) {
CString sLocalFile = CUtils::ChangeDir(m_sPath, sFile, m_pUser->GetHomePath());
CString sLocalFile = CUtils::ChangeDir(m_sPath, sFile, CZNC::Get().GetHomePath());
m_pUser->GetFile(m_pUser->GetCurNick(), CUtils::GetIP(uLongIP), uPort, sLocalFile, uFileSize, GetModName());