Send PONGs for client's PINGs if we are not connected to a server

Thanks to SilverLeo for the patch (I changed those spaces into tabs and added
some *huge* comment on top).


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1016 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
psychon
2008-04-04 14:12:16 +00:00
parent 1f4963c452
commit 654a55a507
+6 -3
View File
@@ -146,9 +146,12 @@ void CClient::ReadLine(const CString& sData) {
} else if (sCommand.CaseCmp("PING") == 0) {
CString sTarget = sLine.Token(1);
if (sTarget.CaseCmp("irc.znc.com") == 0) {
PutClient("PONG " + sLine.substr(5));
return;
// 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.CaseCmp("irc.znc.com") == 0 || !m_pIRCSock) {
PutClient("PONG " + sLine.substr(5));
return;
}
} else if (sCommand.CaseCmp("PONG") == 0) {
return; // Block pong replies, we already responded to the pings