diff --git a/User.cpp b/User.cpp index 92b5a72b..061e4b80 100644 --- a/User.cpp +++ b/User.cpp @@ -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 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::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; diff --git a/User.h b/User.h index 834ae967..c18e847a 100644 --- a/User.h +++ b/User.h @@ -53,7 +53,6 @@ public: bool AddChan(const CString& sName, bool bInConfig); bool DelChan(const CString& sName); void JoinChans(); - bool JoinChan(CChan* pChan); CServer* FindServer(const CString& sName) const; bool DelServer(const CString& sName, unsigned short uPort, const CString& sPass); bool AddServer(const CString& sName); @@ -224,6 +223,8 @@ public: CString GetSkinName() const; // !Getters private: + bool JoinChan(CChan* pChan); + protected: CString m_sUserName; CString m_sCleanUserName;