From 654a55a5073b18ab8a1cfe6c29fcfe45e3a8c6b2 Mon Sep 17 00:00:00 2001 From: psychon Date: Fri, 4 Apr 2008 14:12:16 +0000 Subject: [PATCH] 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 --- Client.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Client.cpp b/Client.cpp index 428ae20a..25ce3af5 100644 --- a/Client.cpp +++ b/Client.cpp @@ -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