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
+9 -8
View File
@@ -35,11 +35,11 @@ public:
{
if (sChannel.Equals(it->first))
{
CChan* pChan = m_pNetwork->FindChan(sChannel);
CChan* pChan = GetNetwork()->FindChan(sChannel);
if (pChan)
{
pChan->JoinUser(true, "", m_pClient);
pChan->JoinUser(true, "", GetClient());
return HALT;
}
}
@@ -86,24 +86,25 @@ public:
virtual void RunJob()
{
if (!m_pNetwork->GetIRCSock())
CIRCNetwork* pNetwork = GetNetwork();
if (!pNetwork->GetIRCSock())
return;
for (MCString::iterator it = BeginNV(); it != EndNV(); ++it)
{
CChan *pChan = m_pNetwork->FindChan(it->first);
CChan *pChan = pNetwork->FindChan(it->first);
if (!pChan) {
pChan = new CChan(it->first, m_pNetwork, true);
pChan = new CChan(it->first, pNetwork, true);
if (!it->second.empty())
pChan->SetKey(it->second);
if (!m_pNetwork->AddChan(pChan)) {
if (!pNetwork->AddChan(pChan)) {
/* AddChan() deleted that channel */
PutModule("Could not join [" + it->first
+ "] (# prefix missing?)");
continue;
}
}
if (!pChan->IsOn() && m_pNetwork->IsIRCConnected()) {
if (!pChan->IsOn() && pNetwork->IsIRCConnected()) {
PutModule("Joining [" + pChan->GetName() + "]");
PutIRC("JOIN " + pChan->GetName() + (pChan->GetKey().empty()
? "" : " " + pChan->GetKey()));
@@ -117,7 +118,7 @@ public:
if (sPageName == "index") {
bool bSubmitted = (WebSock.GetParam("submitted").ToInt() != 0);
const vector<CChan*>& Channels = m_pNetwork->GetChans();
const vector<CChan*>& Channels = GetNetwork()->GetChans();
for (unsigned int c = 0; c < Channels.size(); c++) {
const CString sChan = Channels[c]->GetName();
bool bStick = FindNV(sChan) != EndNV();