From eafccc7b7d5df4311372369a7205e2c01f1949db Mon Sep 17 00:00:00 2001 From: cflakes Date: Wed, 21 Jul 2010 17:53:07 +0000 Subject: [PATCH] Made fakeonline behave properly when ZNC is not connected to any IRC server. Reported by devilspgd's imaginary girl friend. Patch by MEEEEE!! git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2091 726aef4b-f618-498e-8847-2d620e286838 --- modules/extra/fakeonline.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/modules/extra/fakeonline.cpp b/modules/extra/fakeonline.cpp index fba17f21..912d5644 100644 --- a/modules/extra/fakeonline.cpp +++ b/modules/extra/fakeonline.cpp @@ -36,7 +36,7 @@ public: // Get the list of nicks which are being asked for sLine.Token(1, true).TrimLeft_n(":").Split(" ", vsNicks, false); - CString sBNCNicks = ""; + CString sBNCNicks; for (it = vsNicks.begin(); it != vsNicks.end(); ++it) { if (IsOnlineModNick(*it)) { sBNCNicks += " " + *it; @@ -45,9 +45,15 @@ public: // Remove the leading space sBNCNicks.LeftChomp(); - // We let the server handle this request and then act on - // the 303 response. - m_ISONRequests.push_back(sBNCNicks); + if (!m_pUser->GetIRCSock()) { + // if we are not connected to any IRC server, send + // an empty or module-nick filled response. + PutUser(":irc.znc.in 303 " + m_pUser->GetNick() + " :" + sBNCNicks); + } else { + // We let the server handle this request and then act on + // the 303 response from the IRC server. + m_ISONRequests.push_back(sBNCNicks); + } } //Handle WHOIS