mirror of
https://github.com/znc/znc.git
synced 2026-03-28 17:42:41 +01:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user