Don't forward WHO replies with multi-prefix to unsupported clients

This commit is contained in:
Kyle Fuller
2012-03-21 11:15:31 +00:00
parent bf25eee520
commit 38ce17906c

View File

@@ -289,7 +289,7 @@ void CIRCSock::ReadLine(const CString& sData) {
break;
}
case 352: {
case 352: { // WHO
// :irc.yourserver.com 352 yournick #chan ident theirhost.com irc.theirserver.com theirnick H :0 Real Name
sServer = sLine.Token(0);
sNick = sLine.Token(7);
@@ -312,6 +312,32 @@ void CIRCSock::ReadLine(const CString& sData) {
vChans[a]->OnWho(sNick, sIdent, sHost);
}
if (m_bNamesx && (sNick.size() > 1) && IsPermChar(sNick[1])) {
// sLine uses multi-prefix
vector<CClient*>& vClients = m_pNetwork->GetClients();
vector<CClient*>::iterator it;
for (it = vClients.begin(); it != vClients.end(); ++it) {
CClient *pClient = *it;
if (pClient->HasNamesx()) {
m_pNetwork->PutUser(sLine, pClient);
} else {
// The client doesn't support multi-prefix so we need to remove
// the other prefixes.
CString sNewLine = sServer + " 352 " + sLine.Token(2) + " " + \
sLine.Token(3) + " " + sIdent + " " + sHost + " " + \
sLine.Token(6) + " " + sNick[0] + \
sNick.substr(sNick.find_first_not_of(GetPerms())) + " " + \
sLine.Token(8, true);
m_pNetwork->PutUser(sNewLine, pClient);
}
}
return;
}
break;
}
case 353: { // NAMES