Permalink
Browse files

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

  • Loading branch information...
Kyle Fuller
Kyle Fuller committed Mar 21, 2012
1 parent bf25eee commit 38ce17906cb99c419f2fc80fb942c0d480f42eb7
Showing with 27 additions and 1 deletion.
  1. +27 −1 src/IRCSock.cpp
View
@@ -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

0 comments on commit 38ce179

Please sign in to comment.