Change the way CUser::JoinChans() works

Hopefully you'll soon see why I did this.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2181 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
psychon
2010-11-15 20:34:36 +00:00
parent 1baa019705
commit 3327a974fe
2 changed files with 11 additions and 4 deletions
+9 -3
View File
@@ -754,6 +754,7 @@ void CUser::JoinChans() {
// still be able to join the rest of your channels.
unsigned int start = rand() % m_vChans.size();
unsigned int uJoins = m_uMaxJoins;
set<CChan*> sChans;
for (unsigned int a = 0; a < m_vChans.size(); a++) {
unsigned int idx = (start + a) % m_vChans.size();
CChan* pChan = m_vChans[idx];
@@ -761,11 +762,18 @@ void CUser::JoinChans() {
if (!JoinChan(pChan))
continue;
sChans.insert(pChan);
// Limit the number of joins
if (uJoins != 0 && --uJoins == 0)
return;
break;
}
}
for (set<CChan*>::iterator it = sChans.begin();
it != sChans.end(); ++it) {
PutIRC("JOIN " + (*it)->GetName() + " " + (*it)->GetKey());
}
}
bool CUser::JoinChan(CChan* pChan) {
@@ -775,8 +783,6 @@ bool CUser::JoinChan(CChan* pChan) {
} else {
pChan->IncJoinTries();
MODULECALL(OnTimerAutoJoin(*pChan), this, NULL, return false);
PutIRC("JOIN " + pChan->GetName() + " " + pChan->GetKey());
return true;
}
return false;