mirror of
https://github.com/znc/znc.git
synced 2026-08-07 17:33:34 +02:00
Overhaul channel join handling
Instead of sending a single JOIN line for each channel, znc now tries to stuff all of the channel that it has decided to join into a single JOIN command. Apparently this helps with some IRCds which decide when to flood someone off based on the number of lines received, not based on the number of bytes. Let's hope for the best... git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2182 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
@@ -770,10 +770,42 @@ void CUser::JoinChans() {
|
||||
}
|
||||
}
|
||||
|
||||
for (set<CChan*>::iterator it = sChans.begin();
|
||||
it != sChans.end(); ++it) {
|
||||
PutIRC("JOIN " + (*it)->GetName() + " " + (*it)->GetKey());
|
||||
while (!sChans.empty())
|
||||
JoinChans(sChans);
|
||||
}
|
||||
|
||||
void CUser::JoinChans(set<CChan*>& sChans) {
|
||||
CString sKeys, sJoin;
|
||||
bool bHaveKey = false;
|
||||
size_t uiJoinLength = strlen("JOIN ");
|
||||
|
||||
while (!sChans.empty()) {
|
||||
set<CChan*>::iterator it = sChans.begin();
|
||||
const CString& sName = (*it)->GetName();
|
||||
const CString& sKey = (*it)->GetKey();
|
||||
size_t len = sName.length() + sKey.length();
|
||||
len += 2; // two comma
|
||||
|
||||
if (!sKeys.empty() && uiJoinLength + len >= 512)
|
||||
break;
|
||||
|
||||
if (!sJoin.empty()) {
|
||||
sJoin += ",";
|
||||
sKeys += ",";
|
||||
}
|
||||
uiJoinLength += len;
|
||||
sJoin += sName;
|
||||
if (!sKey.empty()) {
|
||||
sKeys += sKey;
|
||||
bHaveKey = true;
|
||||
}
|
||||
sChans.erase(it);
|
||||
}
|
||||
|
||||
if (bHaveKey)
|
||||
PutIRC("JOIN " + sJoin + " " + sKeys);
|
||||
else
|
||||
PutIRC("JOIN " + sJoin);
|
||||
}
|
||||
|
||||
bool CUser::JoinChan(CChan* pChan) {
|
||||
|
||||
Reference in New Issue
Block a user