Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Don't forward WHO replies with multi-prefix to unsupported clients
  • Loading branch information
kylef committed Mar 21, 2012
1 parent bf25eee commit 38ce179
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion src/IRCSock.cpp
Expand Up @@ -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);
Expand All @@ -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
Expand Down

0 comments on commit 38ce179

Please sign in to comment.