Modules: use public API

Avoid accessing protected member variables directly, so
there's a chance of cleaning up the module API later.
This commit is contained in:
J-P Nurmi
2014-10-06 19:18:31 +02:00
parent d9ae3fa7c8
commit 1bacec1dd3
40 changed files with 291 additions and 270 deletions

View File

@@ -60,17 +60,17 @@ public:
}
virtual ~CShellMod() {
vector<Csock*> vSocks = m_pManager->FindSocksByName("SHELL");
vector<Csock*> vSocks = GetManager()->FindSocksByName("SHELL");
for (unsigned int a = 0; a < vSocks.size(); a++) {
m_pManager->DelSockByAddr(vSocks[a]);
GetManager()->DelSockByAddr(vSocks[a]);
}
}
virtual bool OnLoad(const CString& sArgs, CString& sMessage)
{
#ifndef MOD_SHELL_ALLOW_EVERYONE
if (!m_pUser->IsAdmin()) {
if (!GetUser()->IsAdmin()) {
sMessage = "You must be admin to use the shell module";
return false;
}
@@ -103,12 +103,12 @@ public:
void PutShell(const CString& sMsg) {
CString sPath = m_sPath.Replace_n(" ", "_");
CString sSource = ":" + GetModNick() + "!shell@" + sPath;
CString sLine = sSource + " PRIVMSG " + m_pClient->GetNick() + " :" + sMsg;
m_pClient->PutClient(sLine);
CString sLine = sSource + " PRIVMSG " + GetClient()->GetNick() + " :" + sMsg;
GetClient()->PutClient(sLine);
}
void RunCommand(const CString& sCommand) {
m_pManager->AddSock(new CShellSock(this, m_pClient, "cd " + m_sPath + " && " + sCommand), "SHELL");
GetManager()->AddSock(new CShellSock(this, GetClient(), "cd " + m_sPath + " && " + sCommand), "SHELL");
}
private:
CString m_sPath;