diff --git a/Client.cpp b/Client.cpp index 02a0b096..4c27ed7b 100644 --- a/Client.cpp +++ b/Client.cpp @@ -180,17 +180,12 @@ void CClient::ReadLine(const CString& sData) { PutStatusNotice("Detached from [" + sChan + "]"); return; } else if (sCommand.Equals("PING")) { - CString sTarget = sLine.Token(1); - - // If the client meant to ping us or we can be sure the server - // won't answer the ping (=no server connected) -> PONG back. - // else: It's the server's job to send a PONG. - if (sTarget.Equals("irc.znc.in") || !GetIRCSock()) { - PutClient("PONG " + sLine.substr(5)); - return; - } + // All PONGs are generated by znc. We will still forward this to + // the ircd, but all PONGs from irc will be blocked. + PutClient(":irc.znc.in PONG irc.znc.in " + sLine.substr(5)); } else if (sCommand.Equals("PONG")) { - return; // Block pong replies, we already responded to the pings + // Block PONGs, we already responded to the pings + return; } else if (sCommand.Equals("JOIN")) { CString sChans = sLine.Token(1); CString sKey = sLine.Token(2); diff --git a/IRCSock.cpp b/IRCSock.cpp index a3421804..07892dcb 100644 --- a/IRCSock.cpp +++ b/IRCSock.cpp @@ -79,11 +79,12 @@ void CIRCSock::ReadLine(const CString& sData) { MODULECALL(OnRaw(sLine), m_pUser, NULL, return); if (sLine.Equals("PING ", false, 5)) { + // Generate a reply and don't forward this to any user, + // we don't want any PING forwarded PutIRC("PONG " + sLine.substr(5)); - m_pUser->PutUser(sLine); return; - } else if (sLine.Token(1).Equals("PONG") && sLine.Token(3).Equals(":ZNC")) { - // We asked for this so don't forward the reply to clients. + } else if (sLine.Token(1).Equals("PONG")) { + // Block PONGs, we already responded to the pings return; } else if (sLine.Equals("ERROR ", false, 6)) { //ERROR :Closing Link: nick[24.24.24.24] (Excess Flood)