From d82eb75d1cdef19950fa0b9c11b3994bc15301db Mon Sep 17 00:00:00 2001 From: psychon Date: Wed, 16 May 2007 22:35:17 +0000 Subject: [PATCH] merge rev 962;965;972-975: - increased select timeout to 0.5 secs (this should save CPU time) - added real-life ISpoof example to the example znc.conf - make away module ignore message from the user (fixes antiidle together with away) - show error message when webadmin cant bind to a port (improved later) - fix /me, it was turned into a CTCP - remove an extra space git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@802 726aef4b-f618-498e-8847-2d620e286838 --- IRCSock.cpp | 17 +++++++++-------- modules/away.cpp | 2 ++ modules/webadmin.cpp | 7 ++++++- znc.conf | 6 ++++-- znc.cpp | 4 ++-- 5 files changed, 23 insertions(+), 13 deletions(-) diff --git a/IRCSock.cpp b/IRCSock.cpp index 628af1d3..6faad514 100644 --- a/IRCSock.cpp +++ b/IRCSock.cpp @@ -687,12 +687,12 @@ bool CIRCSock::OnCTCPReply(CNick& Nick, CString& sMessage) { } bool CIRCSock::OnPrivCTCP(CNick& Nick, CString& sMessage) { - if (sMessage.Token(0).CaseCmp("ACTION") == 0) { - sMessage = sMessage.Token(1, true); + if (sMessage.Left(7).CaseCmp("ACTION ") == 0) { + sMessage = sMessage.substr(7); MODULECALL(OnPrivAction(Nick, sMessage), m_pUser, NULL, return true); - } else { - MODULECALL(OnPrivCTCP(Nick, sMessage), m_pUser, NULL, return true); + sMessage = "ACTION " + sMessage; } + MODULECALL(OnPrivCTCP(Nick, sMessage), m_pUser, NULL, return true); if (strncasecmp(sMessage.c_str(), "DCC ", 4) == 0 && m_pUser && m_pUser->BounceDCCs() && m_pUser->IsUserAttached()) { // DCC CHAT chat 2453612361 44592 @@ -794,14 +794,15 @@ bool CIRCSock::OnChanCTCP(CNick& Nick, const CString& sChan, CString& sMessage) CChan* pChan = m_pUser->FindChan(sChan); if (pChan) { // Record a /me - if (sMessage.Token(0).CaseCmp("ACTION") == 0) { + if (sMessage.Left(7).CaseCmp("ACTION ") == 0) { + sMessage = sMessage.substr(7); if(pChan->KeepBuffer() || !m_pUser->IsUserAttached()) { - pChan->AddBuffer(":" + Nick.GetNickMask() + " PRIVMSG " + sChan + " :\001ACTION " + m_pUser->AddTimestamp(sMessage.Token(1, true)) + "\001"); + pChan->AddBuffer(":" + Nick.GetNickMask() + " PRIVMSG " + sChan + " :\001ACTION " + m_pUser->AddTimestamp(sMessage) + "\001"); } MODULECALL(OnChanAction(Nick, *pChan, sMessage), m_pUser, NULL, return true); - } else { - MODULECALL(OnChanCTCP(Nick, *pChan, sMessage), m_pUser, NULL, return true); + sMessage = "ACTION " + sMessage; } + MODULECALL(OnChanCTCP(Nick, *pChan, sMessage), m_pUser, NULL, return true); } return (pChan && pChan->IsDetached()); diff --git a/modules/away.cpp b/modules/away.cpp index d5eb7878..60b58e17 100644 --- a/modules/away.cpp +++ b/modules/away.cpp @@ -484,6 +484,8 @@ private: void AddMessage( time_t iTime, const CNick & Nick, CString & sMessage ) { + if (m_pUser && Nick.GetNick() == m_pUser->GetIRCNick().GetNick()) + return; // ignore messages from self AddMessage( CString( iTime ) + ":" + Nick.GetNickMask() + ":" + sMessage ); } diff --git a/modules/webadmin.cpp b/modules/webadmin.cpp index fcce7b11..044cc580 100644 --- a/modules/webadmin.cpp +++ b/modules/webadmin.cpp @@ -163,7 +163,12 @@ public: } #endif - return m_pManager->ListenHost(m_uPort, "WebAdmin::Listener", m_sListenHost, bSSL, SOMAXCONN, pListenSock, 0, bIPv6); + bool b = m_pManager->ListenHost(m_uPort, "WebAdmin::Listener", m_sListenHost, bSSL, SOMAXCONN, pListenSock, 0, bIPv6); + if (!b) { + printf("\n"); // dont mix it up with the 'loading module' message + CUtils::PrintMessage("Error: " + CString(strerror(errno)), true); + } + return b; } void AddSock(CWebAdminSock* pSock) { diff --git a/znc.conf b/znc.conf index 38ca931d..8a0fdb4e 100644 --- a/znc.conf +++ b/znc.conf @@ -8,8 +8,10 @@ // If the port is prepended with a '+' then znc listens using ssl. Note: znc must be compiled with ssl enabled. ListenPort = 12345 -// If you define the ISpoofFile, znc will write the ident of the user trying to connect to the file. Very useful if your box supports oidentd. -#ISpoofFile = /tmp/ispoof +// If you define the ISpoofFile, znc will write the ident of the user trying to connect to the file. +// This example is for oidentd: +#ISpoofFile = /home//.oidentd.conf +#ISpoofFormat = global { reply "%" } // This is the pid file that is needed if you want to crontab the zncchk shell script PidFile = znc.pid diff --git a/znc.cpp b/znc.cpp index 179bb66a..9ffcc712 100644 --- a/znc.cpp +++ b/znc.cpp @@ -59,7 +59,7 @@ CString CZNC::GetTag(bool bIncludeVersion) { char szBuf[128]; memset(szBuf, 0, 128); - snprintf(szBuf, 127, "ZNC %1.3f by prozac - http://znc.sourceforge.net", VERSION); + snprintf(szBuf, 127, "ZNC %1.3f by prozac - http://znc.sourceforge.net", VERSION); return szBuf; } @@ -81,7 +81,7 @@ bool CZNC::OnBoot() { } int CZNC::Loop() { - m_Manager.SetSelectTimeout(10000); + m_Manager.SetSelectTimeout(500000); m_itUserIter = m_msUsers.begin(); time_t tNextConnect = 0;