mirror of
https://github.com/znc/znc.git
synced 2026-05-14 21:35:47 +02:00
Use that new define everywhere
Now there are no uses of DEBUG_ONLY() left :( git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1349 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
+8
-8
@@ -65,7 +65,7 @@ void CClient::ReadLine(const CString& sData) {
|
||||
|
||||
sLine.TrimRight("\n\r");
|
||||
|
||||
DEBUG_ONLY(cout << "(" << ((m_pUser) ? m_pUser->GetUserName() : GetRemoteIP()) << ") CLI -> ZNC [" << sLine << "]" << endl);
|
||||
DEBUG("(" << ((m_pUser) ? m_pUser->GetUserName() : GetRemoteIP()) << ") CLI -> ZNC [" << sLine << "]");
|
||||
|
||||
#ifdef _MODULES
|
||||
if (IsAttached()) {
|
||||
@@ -679,16 +679,16 @@ void CClient::LoginTimeout() {
|
||||
}
|
||||
|
||||
void CClient::Connected() {
|
||||
DEBUG_ONLY(cout << GetSockName() << " == Connected();" << endl);
|
||||
DEBUG(GetSockName() << " == Connected();");
|
||||
SetTimeout(240, TMO_READ); // Now that we are connected, let nature take its course
|
||||
}
|
||||
|
||||
void CClient::ConnectionRefused() {
|
||||
DEBUG_ONLY(cout << GetSockName() << " == ConnectionRefused()" << endl);
|
||||
DEBUG(GetSockName() << " == ConnectionRefused()");
|
||||
}
|
||||
|
||||
void CClient::Disconnected() {
|
||||
DEBUG_ONLY(cout << GetSockName() << " == Disconnected()" << endl);
|
||||
DEBUG(GetSockName() << " == Disconnected()");
|
||||
if (m_pUser) {
|
||||
m_pUser->UserDisconnected(this);
|
||||
}
|
||||
@@ -699,7 +699,7 @@ void CClient::Disconnected() {
|
||||
}
|
||||
|
||||
void CClient::ReachedMaxBuffer() {
|
||||
DEBUG_ONLY(cout << GetSockName() << " == ReachedMaxBuffer()" << endl);
|
||||
DEBUG(GetSockName() << " == ReachedMaxBuffer()");
|
||||
if (IsAttached()) {
|
||||
PutClient("ERROR :Closing link [Too long raw line]");
|
||||
}
|
||||
@@ -727,7 +727,7 @@ void CClient::PutIRC(const CString& sLine) {
|
||||
}
|
||||
|
||||
void CClient::PutClient(const CString& sLine) {
|
||||
DEBUG_ONLY(cout << "(" << ((m_pUser) ? m_pUser->GetUserName() : GetRemoteIP()) << ") ZNC -> CLI [" << sLine << "]" << endl);
|
||||
DEBUG("(" << ((m_pUser) ? m_pUser->GetUserName() : GetRemoteIP()) << ") ZNC -> CLI [" << sLine << "]");
|
||||
Write(sLine + "\r\n");
|
||||
}
|
||||
|
||||
@@ -752,7 +752,7 @@ void CClient::PutModNotice(const CString& sModule, const CString& sLine) {
|
||||
return;
|
||||
}
|
||||
|
||||
DEBUG_ONLY(cout << "(" << m_pUser->GetUserName() << ") ZNC -> CLI [:" + m_pUser->GetStatusPrefix() + ((sModule.empty()) ? "status" : sModule) + "!znc@znc.in NOTICE " << GetNick() << " :" << sLine << "]" << endl);
|
||||
DEBUG("(" << m_pUser->GetUserName() << ") ZNC -> CLI [:" + m_pUser->GetStatusPrefix() + ((sModule.empty()) ? "status" : sModule) + "!znc@znc.in NOTICE " << GetNick() << " :" << sLine << "]");
|
||||
Write(":" + m_pUser->GetStatusPrefix() + ((sModule.empty()) ? "status" : sModule) + "!znc@znc.in NOTICE " + GetNick() + " :" + sLine + "\r\n");
|
||||
}
|
||||
|
||||
@@ -761,7 +761,7 @@ void CClient::PutModule(const CString& sModule, const CString& sLine) {
|
||||
return;
|
||||
}
|
||||
|
||||
DEBUG_ONLY(cout << "(" << m_pUser->GetUserName() << ") ZNC -> CLI [:" + m_pUser->GetStatusPrefix() + ((sModule.empty()) ? "status" : sModule) + "!znc@znc.in PRIVMSG " << GetNick() << " :" << sLine << "]" << endl);
|
||||
DEBUG("(" << m_pUser->GetUserName() << ") ZNC -> CLI [:" + m_pUser->GetStatusPrefix() + ((sModule.empty()) ? "status" : sModule) + "!znc@znc.in PRIVMSG " << GetNick() << " :" << sLine << "]");
|
||||
Write(":" + m_pUser->GetStatusPrefix() + ((sModule.empty()) ? "status" : sModule) + "!znc@znc.in PRIVMSG " + GetNick() + " :" + sLine + "\r\n");
|
||||
}
|
||||
|
||||
|
||||
+11
-11
@@ -33,13 +33,13 @@ void CDCCBounce::ReadLine(const CString& sData) {
|
||||
sLine.RightChomp();
|
||||
}
|
||||
|
||||
DEBUG_ONLY(cout << GetSockName() << " <- [" << sLine << "]" << endl);
|
||||
DEBUG(GetSockName() << " <- [" << sLine << "]");
|
||||
|
||||
PutPeer(sLine);
|
||||
}
|
||||
|
||||
void CDCCBounce::ReachedMaxBuffer() {
|
||||
DEBUG_ONLY(cout << GetSockName() << " == ReachedMaxBuffer()" << endl);
|
||||
DEBUG(GetSockName() << " == ReachedMaxBuffer()");
|
||||
|
||||
CString sType = (m_bIsChat) ? "Chat" : "Xfer";
|
||||
|
||||
@@ -56,8 +56,8 @@ void CDCCBounce::ReadData(const char* data, int len) {
|
||||
BufLen = m_pPeer->GetInternalWriteBuffer().length();
|
||||
|
||||
if (BufLen >= m_uiMaxDCCBuffer) {
|
||||
DEBUG_ONLY(cout << GetSockName() << " The send buffer is over the "
|
||||
"limit (" << BufLen <<"), throttling" << endl);
|
||||
DEBUG(GetSockName() << " The send buffer is over the "
|
||||
"limit (" << BufLen <<"), throttling");
|
||||
PauseRead();
|
||||
}
|
||||
}
|
||||
@@ -69,7 +69,7 @@ void CDCCBounce::ReadPaused() {
|
||||
}
|
||||
|
||||
void CDCCBounce::Timeout() {
|
||||
DEBUG_ONLY(cout << GetSockName() << " == Timeout()" << endl);
|
||||
DEBUG(GetSockName() << " == Timeout()");
|
||||
CString sType = (m_bIsChat) ? "Chat" : "Xfer";
|
||||
|
||||
if (IsRemote()) {
|
||||
@@ -87,7 +87,7 @@ void CDCCBounce::Timeout() {
|
||||
}
|
||||
|
||||
void CDCCBounce::ConnectionRefused() {
|
||||
DEBUG_ONLY(cout << GetSockName() << " == ConnectionRefused()" << endl);
|
||||
DEBUG(GetSockName() << " == ConnectionRefused()");
|
||||
|
||||
CString sType = (m_bIsChat) ? "Chat" : "Xfer";
|
||||
CString sHost = Csock::GetHostName();
|
||||
@@ -101,7 +101,7 @@ void CDCCBounce::ConnectionRefused() {
|
||||
}
|
||||
|
||||
void CDCCBounce::SockError(int iErrno) {
|
||||
DEBUG_ONLY(cout << GetSockName() << " == SockError(" << iErrno << ")" << endl);
|
||||
DEBUG(GetSockName() << " == SockError(" << iErrno << ")");
|
||||
CString sType = (m_bIsChat) ? "Chat" : "Xfer";
|
||||
|
||||
if (IsRemote()) {
|
||||
@@ -117,17 +117,17 @@ void CDCCBounce::SockError(int iErrno) {
|
||||
}
|
||||
|
||||
void CDCCBounce::Connected() {
|
||||
DEBUG_ONLY(cout << GetSockName() << " == Connected()" << endl);
|
||||
DEBUG(GetSockName() << " == Connected()");
|
||||
SetTimeout(0);
|
||||
}
|
||||
|
||||
void CDCCBounce::Disconnected() {
|
||||
DEBUG_ONLY(cout << GetSockName() << " == Disconnected()" << endl);
|
||||
DEBUG(GetSockName() << " == Disconnected()");
|
||||
}
|
||||
|
||||
void CDCCBounce::Shutdown() {
|
||||
m_pPeer = NULL;
|
||||
DEBUG_ONLY(cout << GetSockName() << " == Close(); because my peer told me to" << endl);
|
||||
DEBUG(GetSockName() << " == Close(); because my peer told me to");
|
||||
Close();
|
||||
}
|
||||
|
||||
@@ -155,7 +155,7 @@ Csock* CDCCBounce::GetSockObj(const CString& sHost, unsigned short uPort) {
|
||||
}
|
||||
|
||||
void CDCCBounce::PutServ(const CString& sLine) {
|
||||
DEBUG_ONLY(cout << GetSockName() << " -> [" << sLine << "]" << endl);
|
||||
DEBUG(GetSockName() << " -> [" << sLine << "]");
|
||||
Write(sLine + "\r\n");
|
||||
}
|
||||
|
||||
|
||||
+6
-6
@@ -22,7 +22,7 @@ CDCCSock::~CDCCSock() {
|
||||
|
||||
void CDCCSock::ReadData(const char* data, int len) {
|
||||
if (!m_pFile) {
|
||||
DEBUG_ONLY(cout << "File not open! closing get." << endl);
|
||||
DEBUG("File not open! closing get.");
|
||||
m_pUser->PutModule(m_sModuleName, ((m_bSend) ? "DCC -> [" : "DCC <- [") + m_sRemoteNick + "][" + m_sFileName + "] - File not open!");
|
||||
Close();
|
||||
}
|
||||
@@ -54,22 +54,22 @@ void CDCCSock::ReadData(const char* data, int len) {
|
||||
}
|
||||
|
||||
void CDCCSock::ConnectionRefused() {
|
||||
DEBUG_ONLY(cout << GetSockName() << " == ConnectionRefused()" << endl);
|
||||
DEBUG(GetSockName() << " == ConnectionRefused()");
|
||||
m_pUser->PutModule(m_sModuleName, ((m_bSend) ? "DCC -> [" : "DCC <- [") + m_sRemoteNick + "][" + m_sFileName + "] - Connection Refused.");
|
||||
}
|
||||
|
||||
void CDCCSock::Timeout() {
|
||||
DEBUG_ONLY(cout << GetSockName() << " == Timeout()" << endl);
|
||||
DEBUG(GetSockName() << " == Timeout()");
|
||||
m_pUser->PutModule(m_sModuleName, ((m_bSend) ? "DCC -> [" : "DCC <- [") + m_sRemoteNick + "][" + m_sFileName + "] - Timed Out.");
|
||||
}
|
||||
|
||||
void CDCCSock::SockError(int iErrno) {
|
||||
DEBUG_ONLY(cout << GetSockName() << " == SockError(" << iErrno << ")" << endl);
|
||||
DEBUG(GetSockName() << " == SockError(" << iErrno << ")");
|
||||
m_pUser->PutModule(m_sModuleName, ((m_bSend) ? "DCC -> [" : "DCC <- [") + m_sRemoteNick + "][" + m_sFileName + "] - Socket Error [" + CString(iErrno) + "]");
|
||||
}
|
||||
|
||||
void CDCCSock::Connected() {
|
||||
DEBUG_ONLY(cout << GetSockName() << " == Connected(" << GetRemoteIP() << ")" << endl);
|
||||
DEBUG(GetSockName() << " == Connected(" << GetRemoteIP() << ")");
|
||||
m_pUser->PutModule(m_sModuleName, ((m_bSend) ? "DCC -> [" : "DCC <- [") + m_sRemoteNick + "][" + m_sFileName + "] - Transfer Started.");
|
||||
|
||||
if (m_bSend) {
|
||||
@@ -82,7 +82,7 @@ void CDCCSock::Connected() {
|
||||
void CDCCSock::Disconnected() {
|
||||
const CString sStart = ((m_bSend) ? "DCC -> [" : "DCC <- [") + m_sRemoteNick + "][" + m_sFileName + "] - ";
|
||||
|
||||
DEBUG_ONLY(cout << GetSockName() << " == Disconnected()" << endl);
|
||||
DEBUG(GetSockName() << " == Disconnected()");
|
||||
|
||||
if (m_uBytesSoFar > m_uFileSize) {
|
||||
m_pUser->PutModule(m_sModuleName, sStart + "TooMuchData!");
|
||||
|
||||
+1
-1
@@ -206,7 +206,7 @@ bool CFile::Copy(const CString& sOldFileName, const CString& sNewFileName, bool
|
||||
|
||||
while ((len = OldFile.Read(szBuf, 8192))) {
|
||||
if (len < 0) {
|
||||
DEBUG_ONLY(cout << "CFile::Copy() failed: " << strerror(errno) << endl);
|
||||
DEBUG("CFile::Copy() failed: " << strerror(errno));
|
||||
OldFile.Close();
|
||||
|
||||
// That file is only a partial copy, get rid of it
|
||||
|
||||
+8
-8
@@ -99,7 +99,7 @@ void CHTTPSock::ReadLine(const CString& sData) {
|
||||
void CHTTPSock::GetPage() {
|
||||
CString sPage;
|
||||
|
||||
DEBUG_ONLY(cout << "Page Request [" << m_sURI << "] ");
|
||||
DEBUG("Page Request [" << m_sURI << "] ");
|
||||
|
||||
if (!OnPageRequest(m_sURI, sPage)) {
|
||||
PrintNotFound();
|
||||
@@ -124,8 +124,8 @@ bool CHTTPSock::PrintFile(const CString& sFileName, CString sContentType) {
|
||||
|
||||
if (sFilePath.Left(m_sDocRoot.size()) != m_sDocRoot) {
|
||||
PrintErrorPage(403, "Forbidden", "You don't have permission to access that file on this server.");
|
||||
DEBUG_ONLY(cout << "THIS FILE: [" << sFilePath << "] does not live in ..." << endl);
|
||||
DEBUG_ONLY(cout << "DOCUMENT ROOT: [" << m_sDocRoot << "]" << endl);
|
||||
DEBUG("THIS FILE: [" << sFilePath << "] does not live in ...");
|
||||
DEBUG("DOCUMENT ROOT: [" << m_sDocRoot << "]");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -188,7 +188,7 @@ bool CHTTPSock::PrintFile(const CString& sFileName, CString sContentType) {
|
||||
}
|
||||
}
|
||||
|
||||
DEBUG_ONLY(cout << "ETag: [" << sETag << "] / If-None-Match [" << m_sIfNoneMatch << "]" << endl);
|
||||
DEBUG("ETag: [" << sETag << "] / If-None-Match [" << m_sIfNoneMatch << "]");
|
||||
|
||||
Close(Csock::CLT_AFTERWRITE);
|
||||
|
||||
@@ -343,7 +343,7 @@ bool CHTTPSock::SentHeader() const {
|
||||
|
||||
bool CHTTPSock::PrintHeader(unsigned long uContentLength, const CString& sContentType, unsigned int uStatusId, const CString& sStatusMsg) {
|
||||
if (SentHeader()) {
|
||||
DEBUG_ONLY(cout << "- Header already sent!" << endl);
|
||||
DEBUG("- Header already sent!");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -355,7 +355,7 @@ bool CHTTPSock::PrintHeader(unsigned long uContentLength, const CString& sConten
|
||||
m_sContentType = "text/html";
|
||||
}
|
||||
|
||||
DEBUG_ONLY(cout << "- " << uStatusId << " (" << sStatusMsg << ") [" << m_sContentType << "]" << endl);
|
||||
DEBUG("- " << uStatusId << " (" << sStatusMsg << ") [" << m_sContentType << "]");
|
||||
|
||||
Write("HTTP/" + CString(m_bHTTP10Client ? "1.0 " : "1.1 ") + CString(uStatusId) + " " + sStatusMsg + "\r\n");
|
||||
//Write("Date: Tue, 28 Jun 2005 20:45:36 GMT\r\n");
|
||||
@@ -390,7 +390,7 @@ bool CHTTPSock::Redirect(const CString& sURL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
DEBUG_ONLY(cout << "- Redirect to [" << sURL << "]" << endl);
|
||||
DEBUG("- Redirect to [" << sURL << "]");
|
||||
CString sPage = GetErrorPage(302, "Found", "The document has moved <a href=\"" + sURL.Escape_n(CString::EHTML) + "\">here</a>.");
|
||||
AddHeader("Location", sURL);
|
||||
PrintHeader(sPage.length(), "text/html", 302, "Found");
|
||||
@@ -414,7 +414,7 @@ void CHTTPSock::Disconnected() {
|
||||
}
|
||||
|
||||
void CHTTPSock::ReachedMaxBuffer() {
|
||||
DEBUG_ONLY(cout << GetSockName() << " == ReachedMaxBuffer()" << endl);
|
||||
DEBUG(GetSockName() << " == ReachedMaxBuffer()");
|
||||
Close();
|
||||
}
|
||||
|
||||
|
||||
+9
-9
@@ -73,7 +73,7 @@ void CIRCSock::ReadLine(const CString& sData) {
|
||||
|
||||
sLine.TrimRight("\n\r");
|
||||
|
||||
DEBUG_ONLY(cout << "(" << m_pUser->GetUserName() << ") IRC -> ZNC [" << sLine << "]" << endl);
|
||||
DEBUG("(" << m_pUser->GetUserName() << ") IRC -> ZNC [" << sLine << "]");
|
||||
|
||||
MODULECALL(OnRaw(sLine), m_pUser, NULL, return);
|
||||
|
||||
@@ -786,7 +786,7 @@ bool CIRCSock::OnChanMsg(CNick& Nick, const CString& sChan, CString& sMessage) {
|
||||
}
|
||||
|
||||
void CIRCSock::PutIRC(const CString& sLine) {
|
||||
DEBUG_ONLY(cout << "(" << m_pUser->GetUserName() << ") ZNC -> IRC [" << sLine << "]" << endl);
|
||||
DEBUG("(" << m_pUser->GetUserName() << ") ZNC -> IRC [" << sLine << "]");
|
||||
Write(sLine + "\r\n");
|
||||
}
|
||||
|
||||
@@ -796,7 +796,7 @@ void CIRCSock::SetNick(const CString& sNick) {
|
||||
}
|
||||
|
||||
void CIRCSock::Connected() {
|
||||
DEBUG_ONLY(cout << GetSockName() << " == Connected()" << endl);
|
||||
DEBUG(GetSockName() << " == Connected()");
|
||||
m_pUser->IRCConnected(this);
|
||||
|
||||
CString sPass = m_sPass;
|
||||
@@ -817,7 +817,7 @@ void CIRCSock::Connected() {
|
||||
void CIRCSock::Disconnected() {
|
||||
MODULECALL(OnIRCDisconnected(), m_pUser, NULL, );
|
||||
|
||||
DEBUG_ONLY(cout << GetSockName() << " == Disconnected()" << endl);
|
||||
DEBUG(GetSockName() << " == Disconnected()");
|
||||
if (!m_pUser->IsBeingDeleted() && m_pUser->GetIRCConnectEnabled() &&
|
||||
m_pUser->GetServers().size() != 0) {
|
||||
m_pUser->PutStatus("Disconnected from IRC. Reconnecting...");
|
||||
@@ -842,8 +842,8 @@ void CIRCSock::SockError(int iErrno) {
|
||||
sError = strerror(iErrno);
|
||||
}
|
||||
|
||||
DEBUG_ONLY(cout << GetSockName() << " == SockError(" << iErrno << " "
|
||||
<< sError << ")" << endl);
|
||||
DEBUG(GetSockName() << " == SockError(" << iErrno << " "
|
||||
<< sError << ")");
|
||||
if (!m_pUser->IsBeingDeleted()) {
|
||||
if (GetConState() != CST_OK)
|
||||
m_pUser->PutStatus("Cannot connect to IRC (" +
|
||||
@@ -860,7 +860,7 @@ void CIRCSock::SockError(int iErrno) {
|
||||
}
|
||||
|
||||
void CIRCSock::Timeout() {
|
||||
DEBUG_ONLY(cout << GetSockName() << " == Timeout()" << endl);
|
||||
DEBUG(GetSockName() << " == Timeout()");
|
||||
if (!m_pUser->IsBeingDeleted()) {
|
||||
m_pUser->PutStatus("IRC connection timed out. Reconnecting...");
|
||||
}
|
||||
@@ -872,7 +872,7 @@ void CIRCSock::Timeout() {
|
||||
}
|
||||
|
||||
void CIRCSock::ConnectionRefused() {
|
||||
DEBUG_ONLY(cout << GetSockName() << " == ConnectionRefused()" << endl);
|
||||
DEBUG(GetSockName() << " == ConnectionRefused()");
|
||||
if (!m_pUser->IsBeingDeleted()) {
|
||||
m_pUser->PutStatus("Connection Refused. Reconnecting...");
|
||||
}
|
||||
@@ -881,7 +881,7 @@ void CIRCSock::ConnectionRefused() {
|
||||
}
|
||||
|
||||
void CIRCSock::ReachedMaxBuffer() {
|
||||
DEBUG_ONLY(cout << GetSockName() << " == ReachedMaxBuffer()" << endl);
|
||||
DEBUG(GetSockName() << " == ReachedMaxBuffer()");
|
||||
m_pUser->PutStatus("Received a too long line from the IRC server!");
|
||||
Quit();
|
||||
}
|
||||
|
||||
+1
-1
@@ -128,7 +128,7 @@ CSocket::~CSocket() {
|
||||
}
|
||||
|
||||
void CSocket::ReachedMaxBuffer() {
|
||||
DEBUG_ONLY(cout << GetSockName() << " == ReachedMaxBuffer()" << endl);
|
||||
DEBUG(GetSockName() << " == ReachedMaxBuffer()");
|
||||
PutModule("Some socket reached its max buffer limit and was closed!");
|
||||
Close();
|
||||
}
|
||||
|
||||
+7
-7
@@ -34,7 +34,7 @@ CString CTemplateLoopContext::GetValue(const CString& sName) {
|
||||
CTemplate* pTemplate = GetCurRow();
|
||||
|
||||
if (!pTemplate) {
|
||||
DEBUG_ONLY(cerr << "Loop [" << GetName() << "] has no row index [" << GetCurRow() << "]" << endl);
|
||||
DEBUG("Loop [" << GetName() << "] has no row index [" << GetCurRow() << "]");
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -74,12 +74,12 @@ CTemplate::~CTemplate() {
|
||||
|
||||
bool CTemplate::SetFile(const CString& sFileName) {
|
||||
if (sFileName.empty()) {
|
||||
DEBUG_ONLY(cerr << "CTemplate::SetFile() - Filename is empty" << endl);
|
||||
DEBUG("CTemplate::SetFile() - Filename is empty");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!CFile::Exists(sFileName)) {
|
||||
DEBUG_ONLY(cerr << "CTemplate::SetFile() - [" << sFileName << "] does not exist" << endl);
|
||||
DEBUG("CTemplate::SetFile() - [" << sFileName << "] does not exist");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -132,14 +132,14 @@ bool CTemplate::Print(ostream& oOut) {
|
||||
|
||||
bool CTemplate::Print(const CString& sFileName, ostream& oOut) {
|
||||
if (sFileName.empty()) {
|
||||
DEBUG_ONLY(cerr << "Empty filename in CTemplate::Print()" << endl);
|
||||
DEBUG("Empty filename in CTemplate::Print()");
|
||||
return false;
|
||||
}
|
||||
|
||||
CFile File(sFileName);
|
||||
|
||||
if (!File.Open()) {
|
||||
DEBUG_ONLY(cerr << "Unable to open file [" << sFileName << "] in CTemplate::Print()" << endl);
|
||||
DEBUG("Unable to open file [" << sFileName << "] in CTemplate::Print()");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -313,8 +313,8 @@ bool CTemplate::Print(const CString& sFileName, ostream& oOut) {
|
||||
}
|
||||
}
|
||||
|
||||
DEBUG_ONLY(cerr << "Malformed tag on line " << uLineNum << " of [" << File.GetLongName() << "]" << endl);
|
||||
DEBUG_ONLY(cerr << "--------------- [" << sLine << "]" << endl);
|
||||
DEBUG("Malformed tag on line " << uLineNum << " of [" << File.GetLongName() << "]");
|
||||
DEBUG("--------------- [" << sLine << "]");
|
||||
}
|
||||
} while (iPos != CString::npos);
|
||||
|
||||
|
||||
@@ -491,7 +491,7 @@ unsigned int CTable::GetColumnIndex(const CString& sName) const {
|
||||
return i;
|
||||
}
|
||||
|
||||
DEBUG_ONLY(cout << "CTable::GetColumnIndex(" + sName + ") failed" << endl);
|
||||
DEBUG("CTable::GetColumnIndex(" + sName + ") failed");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ public:
|
||||
}
|
||||
|
||||
if (pUser && m_Cache.HasItem(CString(Auth->GetUsername() + ":" + Auth->GetPassword()).MD5())) {
|
||||
DEBUG_ONLY(cerr << "+++ Found in cache" << endl);
|
||||
DEBUG("+++ Found in cache");
|
||||
Auth->AcceptLogin(*pUser);
|
||||
return HALT;
|
||||
}
|
||||
@@ -140,10 +140,10 @@ void CIMAPSock::ReadLine(const CString& sLine) {
|
||||
if (pUser && sLine.Equals("AUTH OK", false, 7)) {
|
||||
m_spAuth->AcceptLogin(*pUser);
|
||||
m_pIMAPMod->CacheLogin(CString(m_spAuth->GetUsername() + ":" + m_spAuth->GetPassword()).MD5()); // Use MD5 so passes don't sit in memory in plain text
|
||||
DEBUG_ONLY(cerr << "+++ Successful IMAP lookup" << endl);
|
||||
DEBUG("+++ Successful IMAP lookup");
|
||||
} else {
|
||||
m_spAuth->RefuseLogin("Invalid Password");
|
||||
DEBUG_ONLY(cerr << "--- FAILED IMAP lookup" << endl);
|
||||
DEBUG("--- FAILED IMAP lookup");
|
||||
}
|
||||
|
||||
m_bSentReply = true;
|
||||
|
||||
+3
-3
@@ -282,7 +282,7 @@ public:
|
||||
sTmp[a] = ' ';
|
||||
}
|
||||
PutModule(sTmp);
|
||||
DEBUG_ONLY(cerr << sTmp << endl);
|
||||
DEBUG(sTmp);
|
||||
}
|
||||
|
||||
CSockManager * GetSockManager() { return(m_pManager); }
|
||||
@@ -1051,7 +1051,7 @@ void CModPerl::LoadPerlMod(const CString & sModule)
|
||||
{
|
||||
if (!m_pUser)
|
||||
{
|
||||
DEBUG_ONLY(cerr << "LoadPerlMod: No User is set!!!" << endl);
|
||||
DEBUG("LoadPerlMod: No User is set!!!");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1082,7 +1082,7 @@ void CModPerl::UnloadPerlMod(const CString & sModule)
|
||||
DestroyAllSocks(sModule);
|
||||
if (!m_pUser)
|
||||
{
|
||||
DEBUG_ONLY(cerr << "UnloadPerlMod: No User is set!!!" << endl);
|
||||
DEBUG("UnloadPerlMod: No User is set!!!");
|
||||
return;
|
||||
}
|
||||
Eval("ZNC::COREUnloadMod('" + m_pUser->GetUserName() + "', '" + sModule + "');");
|
||||
|
||||
@@ -62,17 +62,17 @@ public:
|
||||
CString const key(CString(user + ":" + pass).MD5());
|
||||
if (m_Cache.HasItem(key)) {
|
||||
Auth->AcceptLogin(*pUser);
|
||||
DEBUG_ONLY(cerr << "+++ Found in cache" << endl);
|
||||
DEBUG("+++ Found in cache");
|
||||
}
|
||||
else if (sasl_server_new("znc", NULL, NULL, NULL, NULL, cbs, 0, &sasl_conn) == SASL_OK &&
|
||||
sasl_checkpass(sasl_conn, user.c_str(), user.size(), pass.c_str(), pass.size()) == SASL_OK) {
|
||||
Auth->AcceptLogin(*pUser);
|
||||
m_Cache.AddItem(key);
|
||||
DEBUG_ONLY(cerr << "+++ Successful SASL password check" << endl);
|
||||
DEBUG("+++ Successful SASL password check");
|
||||
}
|
||||
else {
|
||||
Auth->RefuseLogin("SASL Authentication failed");
|
||||
DEBUG_ONLY(cerr << "--- FAILED SASL password check" << endl);
|
||||
DEBUG("--- FAILED SASL password check");
|
||||
}
|
||||
|
||||
sasl_dispose(&sasl_conn);
|
||||
|
||||
@@ -609,14 +609,14 @@ bool CWebAdminSock::SettingsPage(CString& sPageRet) {
|
||||
CModule *pMod = CZNC::Get().GetModules().FindModule(sModName);
|
||||
if (!pMod) {
|
||||
if (!CZNC::Get().GetModules().LoadModule(sModName, sArgs, NULL, sModRet)) {
|
||||
DEBUG_ONLY(cerr << "Unable to load module [" << sModName << "] [" << sModRet << "]" << endl);
|
||||
DEBUG("Unable to load module [" << sModName << "] [" << sModRet << "]");
|
||||
}
|
||||
} else if (pMod->GetArgs() != sArgs) {
|
||||
if (!CZNC::Get().GetModules().ReloadModule(sModName, sArgs, NULL, sModRet)) {
|
||||
DEBUG_ONLY(cerr << "Unable to reload module [" << sModName << "] [" << sModRet << "]" << endl);
|
||||
DEBUG("Unable to reload module [" << sModName << "] [" << sModRet << "]");
|
||||
}
|
||||
} else {
|
||||
DEBUG_ONLY(cerr << "Unable to load module [" << sModName << "] because it is already loaded" << endl);
|
||||
DEBUG("Unable to load module [" << sModName << "] because it is already loaded");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1047,10 +1047,10 @@ CUser* CWebAdminSock::GetNewUser(CString& sPageRet, CUser* pUser) {
|
||||
|
||||
try {
|
||||
if (!pNewUser->GetModules().LoadModule(sModName, sArgs, pNewUser, sModRet, (pUser != NULL))) {
|
||||
DEBUG_ONLY(cerr << "Unable to load module [" << sModName << "] [" << sModRet << "]" << endl);
|
||||
DEBUG("Unable to load module [" << sModName << "] [" << sModRet << "]");
|
||||
}
|
||||
} catch (...) {
|
||||
DEBUG_ONLY(cerr << "Unable to load module [" << sModName << "] [" << sArgs << "]" << endl);
|
||||
DEBUG("Unable to load module [" << sModName << "] [" << sArgs << "]");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1064,10 +1064,10 @@ CUser* CWebAdminSock::GetNewUser(CString& sPageRet, CUser* pUser) {
|
||||
|
||||
try {
|
||||
if (!pNewUser->GetModules().LoadModule(sModName, sArgs, pNewUser, sModRet, (pUser != NULL))) {
|
||||
DEBUG_ONLY(cerr << "Unable to load module [" << sModName << "] [" << sModRet << "]" << endl);
|
||||
DEBUG("Unable to load module [" << sModName << "] [" << sModRet << "]");
|
||||
}
|
||||
} catch (...) {
|
||||
DEBUG_ONLY(cerr << "Unable to load module [" << sModName << "]" << endl);
|
||||
DEBUG("Unable to load module [" << sModName << "]");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,12 +146,12 @@ bool CZNC::ConnectUser(CUser *pUser) {
|
||||
return false;
|
||||
|
||||
if (!WriteISpoof(pUser)) {
|
||||
DEBUG_ONLY(cout << "ISpoof could not be written" << endl);
|
||||
DEBUG("ISpoof could not be written");
|
||||
pUser->PutStatus("ISpoof could not be written, retrying...");
|
||||
return true;
|
||||
}
|
||||
|
||||
DEBUG_ONLY(cout << "User [" << pUser->GetUserName() << "] is connecting to [" << pServer->GetName() << ":" << pServer->GetPort() << "] ..." << endl);
|
||||
DEBUG("User [" << pUser->GetUserName() << "] is connecting to [" << pServer->GetName() << ":" << pServer->GetPort() << "] ...");
|
||||
pUser->PutStatus("Attempting to connect to [" + pServer->GetName() + ":" + CString(pServer->GetPort()) + "] ...");
|
||||
|
||||
pIRCSock = new CIRCSock(pUser);
|
||||
@@ -558,14 +558,14 @@ bool CZNC::WriteConfig() {
|
||||
CString sErr;
|
||||
|
||||
if (!it->second->IsValid(sErr)) {
|
||||
DEBUG_ONLY(cerr << "** Error writing config for user [" << it->first << "] [" << sErr << "]" << endl);
|
||||
DEBUG("** Error writing config for user [" << it->first << "] [" << sErr << "]");
|
||||
continue;
|
||||
}
|
||||
|
||||
File.Write("\n");
|
||||
|
||||
if (!it->second->WriteConfig(File)) {
|
||||
DEBUG_ONLY(cerr << "** Error writing config for user [" << it->first << "]" << endl);
|
||||
DEBUG("** Error writing config for user [" << it->first << "]");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1065,7 +1065,7 @@ bool CZNC::DoRehash(CString& sError)
|
||||
if (!pRealUser->Clone(*pUser, sErr)
|
||||
|| !AddUser(pRealUser, sErr)) {
|
||||
sError = "Invalid user [" + pUser->GetUserName() + "] " + sErr;
|
||||
DEBUG_ONLY(cout << "CUser::Clone() failed in rehash" << endl);
|
||||
DEBUG("CUser::Clone() failed in rehash");
|
||||
}
|
||||
pUser->SetBeingDeleted(true);
|
||||
delete pUser;
|
||||
@@ -1695,18 +1695,16 @@ bool CZNC::DeleteUser(const CString& sUsername) {
|
||||
|
||||
bool CZNC::AddUser(CUser* pUser, CString& sErrorRet) {
|
||||
if (FindUser(pUser->GetUserName()) != NULL) {
|
||||
DEBUG_ONLY(cout << "User [" << pUser->GetUserName() << "]"
|
||||
" - already exists" << endl);
|
||||
DEBUG("User [" << pUser->GetUserName() << "] - already exists");
|
||||
return false;
|
||||
}
|
||||
if (!pUser->IsValid(sErrorRet)) {
|
||||
DEBUG_ONLY(cout << "Invalid user [" << pUser->GetUserName() << "]"
|
||||
" - [" << sErrorRet << "]" << endl);
|
||||
DEBUG("Invalid user [" << pUser->GetUserName() << "] - ["
|
||||
<< sErrorRet << "]");
|
||||
return false;
|
||||
}
|
||||
m_msUsers[pUser->GetUserName()] = pUser;
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
CZNC& CZNC::Get() {
|
||||
@@ -1814,8 +1812,7 @@ protected:
|
||||
// The timer runs until it once didn't find any users to connect
|
||||
bUsersLeft = true;
|
||||
|
||||
DEBUG_ONLY(cout << "Connecting user [" << pUser->GetUserName()
|
||||
<< "]" << endl);
|
||||
DEBUG("Connecting user [" << pUser->GetUserName() << "]");
|
||||
|
||||
if (CZNC::Get().ConnectUser(pUser))
|
||||
// User connecting, wait until next time timer fires
|
||||
@@ -1823,7 +1820,7 @@ protected:
|
||||
}
|
||||
|
||||
if (bUsersLeft == false) {
|
||||
DEBUG_ONLY(cout << "ConnectUserTimer done" << endl);
|
||||
DEBUG("ConnectUserTimer done");
|
||||
CZNC::Get().DisableConnectUser();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -226,7 +226,7 @@ public:
|
||||
virtual ~CRealListener() {}
|
||||
|
||||
virtual bool ConnectionFrom(const CString& sHost, unsigned short uPort) {
|
||||
DEBUG_ONLY(cout << GetSockName() << " == ConnectionFrom(" << sHost << ", " << uPort << ")" << endl);
|
||||
DEBUG(GetSockName() << " == ConnectionFrom(" << sHost << ", " << uPort << ")");
|
||||
return CZNC::Get().IsHostAllowed(sHost);
|
||||
}
|
||||
|
||||
@@ -239,7 +239,7 @@ public:
|
||||
}
|
||||
|
||||
virtual void SockError(int iErrno) {
|
||||
DEBUG_ONLY(cout << GetSockName() << " == SockError(" << strerror(iErrno) << ")" << endl);
|
||||
DEBUG(GetSockName() << " == SockError(" << strerror(iErrno) << ")");
|
||||
if (iErrno == EMFILE) {
|
||||
// We have too many open fds, let's close this listening port to be able to continue
|
||||
// to work, next rehash will (try to) reopen it.
|
||||
|
||||
Reference in New Issue
Block a user