From 9b671ee9762d31f380eacc708004ca521bf2a39d Mon Sep 17 00:00:00 2001 From: psychon Date: Wed, 16 May 2007 22:20:10 +0000 Subject: [PATCH] merge rev 936, 939-943 from psychon branch: - if a client connected before znc connected to irc and if it uses a wrong nick it wasnt informed of this -> fixed - znc.cpp didnt work with --disable-modules - some stuff which was already merged previously git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@800 726aef4b-f618-498e-8847-2d620e286838 --- Client.cpp | 4 ++-- Client.h | 2 +- IRCSock.cpp | 10 +++++----- configure.in | 2 +- znc.cpp | 2 ++ 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/Client.cpp b/Client.cpp index b495d269..78a6c1db 100644 --- a/Client.cpp +++ b/Client.cpp @@ -1564,10 +1564,10 @@ void CClient::PutModule(const CString& sModule, const CString& sLine) { Write(":" + m_pUser->GetStatusPrefix() + ((sModule.empty()) ? "status" : sModule) + "!znc@znc.com PRIVMSG " + GetNick() + " :" + sLine + "\r\n"); } -CString CClient::GetNick() const { +CString CClient::GetNick(bool bAllowIRCNick) const { CString sRet; - if ((m_bAuthed) && (m_pIRCSock)) { + if ((bAllowIRCNick) && (m_bAuthed) && (m_pIRCSock)) { sRet = m_pIRCSock->GetNick(); } diff --git a/Client.h b/Client.h index f8e7923f..9fc14613 100644 --- a/Client.h +++ b/Client.h @@ -90,7 +90,7 @@ public: void AcceptLogin(CUser& User); void RefuseLogin(const CString& sReason); - CString GetNick() const; + CString GetNick(bool bAllowIRCNick = true) const; CString GetNickMask() const; bool HasNamesx() const { return m_bNamesx; } bool HasUHNames() const { return m_bUHNames; } diff --git a/IRCSock.cpp b/IRCSock.cpp index 1b93ef9b..628af1d3 100644 --- a/IRCSock.cpp +++ b/IRCSock.cpp @@ -92,10 +92,6 @@ void CIRCSock::ReadLine(const CString& sData) { SetTimeout(900); // Now that we are connected, let nature take its course PutIRC("WHO " + sNick); - SetNick(sNick); - - MODULECALL(OnIRCConnected(), m_pUser, NULL, ); - m_bAuthed = true; m_pUser->PutStatus("Connected!"); @@ -103,7 +99,7 @@ void CIRCSock::ReadLine(const CString& sData) { for (unsigned int a = 0; a < vClients.size(); a++) { CClient* pClient = vClients[a]; - CString sClientNick = pClient->GetNick(); + CString sClientNick = pClient->GetNick(false); if (sClientNick.CaseCmp(sNick) != 0) { // If they connected with a nick that doesn't match the one we got on irc, then we need to update them @@ -111,6 +107,10 @@ void CIRCSock::ReadLine(const CString& sData) { } } + SetNick(sNick); + + MODULECALL(OnIRCConnected(), m_pUser, NULL, ); + m_pUser->ClearRawBuffer(); m_pUser->AddRawBuffer(":" + sServer + " " + sCmd + " ", " " + sRest); diff --git a/configure.in b/configure.in index 6450ad3f..561e4d32 100644 --- a/configure.in +++ b/configure.in @@ -148,7 +148,7 @@ if test "$MODULES" = "yes"; then fi fi -VERSION=`grep '#define VERSION' main.h | awk '{print $3}'` +VERSION=`grep '#define VERSION' main.h | awk '{print $3}' | head -n 1` # # Auto detect modules diff --git a/znc.cpp b/znc.cpp index f5443c64..962b9a7d 100644 --- a/znc.cpp +++ b/znc.cpp @@ -1187,7 +1187,9 @@ bool CZNC::ParseConfig(const CString& sConfig) { return false; } +#ifdef _MODULES GetModules().OnFinishedConfig(); +#endif return true; }