Split up CUser::JoinChans()

This adds CUser::JoinChan() as a helper function


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1601 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
psychon
2009-08-17 18:49:39 +00:00
parent 8cc6b19bca
commit 6782ba987e
2 changed files with 20 additions and 12 deletions

View File

@@ -708,23 +708,30 @@ void CUser::JoinChans() {
for (unsigned int a = 0; a < m_vChans.size(); a++) {
CChan* pChan = m_vChans[a];
if (!pChan->IsOn() && !pChan->IsDisabled()) {
if (JoinTries() != 0 && pChan->GetJoinTries() >= JoinTries()) {
PutStatus("The channel " + pChan->GetName() + " could not be joined, disabling it.");
pChan->Disable();
} else {
pChan->IncJoinTries();
MODULECALL(OnTimerAutoJoin(*pChan), this, NULL, continue);
if (!JoinChan(pChan))
continue;
PutIRC("JOIN " + pChan->GetName() + " " + pChan->GetKey());
// Limit the number of joins
if (uJoins != 0 && --uJoins == 0)
return;
}
// Limit the number of joins
if (uJoins != 0 && --uJoins == 0)
return;
}
}
}
bool CUser::JoinChan(CChan* pChan) {
if (JoinTries() != 0 && pChan->GetJoinTries() >= JoinTries()) {
PutStatus("The channel " + pChan->GetName() + " could not be joined, disabling it.");
pChan->Disable();
} else {
pChan->IncJoinTries();
MODULECALL(OnTimerAutoJoin(*pChan), this, NULL, return false);
PutIRC("JOIN " + pChan->GetName() + " " + pChan->GetKey());
return true;
}
return false;
}
CServer* CUser::FindServer(const CString& sName) const {
for (unsigned int a = 0; a < m_vServers.size(); a++) {
CServer* pServer = m_vServers[a];