Rethink PING/PONG handling

All PINGs are replied by ZNC, only PINGs from the client are forwarded.
All PONGs are blocked.

This should solve all issues with annoying PONGs showing up in clients.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2043 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
psychon
2010-06-25 15:51:16 +00:00
parent ced990fb87
commit bc40713b61
2 changed files with 9 additions and 13 deletions

View File

@@ -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);