From da9e5d35fab2c3d061e6ba15c19e9810d33aec93 Mon Sep 17 00:00:00 2001 From: prozacx Date: Tue, 12 Apr 2005 04:43:48 +0000 Subject: [PATCH] Cache the MOTD git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@130 726aef4b-f618-498e-8847-2d620e286838 --- IRCSock.cpp | 9 +++++++-- IRCSock.h | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/IRCSock.cpp b/IRCSock.cpp index 69f839f2..fcc6dc84 100644 --- a/IRCSock.cpp +++ b/IRCSock.cpp @@ -13,7 +13,7 @@ CIRCSock::CIRCSock(CZNC* pZNC, CUser* pUser) : Csock() { m_bKeepNick = true; m_bAuthed = false; EnableReadLine(); - m_RawBuffer.SetLineCount(100); // This should be more than enough raws, especially since we are asking the server to resend MOTD + m_RawBuffer.SetLineCount(100); // This should be more than enough raws, especially since we are buffering the MOTD separately m_Nick.SetIdent(pUser->GetIdent()); m_Nick.SetHost(pUser->GetVHost()); } @@ -116,8 +116,10 @@ void CIRCSock::ReadLine(const string& sData) { m_RawBuffer.AddLine(":" + sServer + " " + sCmd + " ", " " + sRest); break; case 372: // motd + m_vsMotdBuffer.clear(); case 375: // begin motd case 376: // end motd + m_vsMotdBuffer.push_back(sLine); break; case 471: // :irc.server.net 471 nick #chan :Cannot join channel (+l) case 473: // :irc.server.net 473 nick #chan :Cannot join channel (+i) @@ -739,7 +741,10 @@ void CIRCSock::UserConnected(CUserSock* pUserSock) { } } - PutServ("MOTD"); + // Send the cached MOTD + for (unsigned int a = 0; a < m_vsMotdBuffer.size(); a++) { + PutUser(m_vsMotdBuffer[a]); + } const vector& vChans = m_pUser->GetChans(); for (unsigned int a = 0; a < vChans.size(); a++) { diff --git a/IRCSock.h b/IRCSock.h index 302f4951..97a05a04 100644 --- a/IRCSock.h +++ b/IRCSock.h @@ -63,6 +63,7 @@ protected: CNick m_Nick; string m_sPass; CBuffer m_RawBuffer; + vector m_vsMotdBuffer; CUserSock* m_pUserSock; map m_msChans; unsigned int m_uQueryBufferCount;