From: <ps...@us...> - 2009-01-25 16:51:57
|
Revision: 1349 http://znc.svn.sourceforge.net/znc/?rev=1349&view=rev Author: psychon Date: 2009-01-25 16:51:54 +0000 (Sun, 25 Jan 2009) Log Message: ----------- Use that new define everywhere Now there are no uses of DEBUG_ONLY() left :( Modified Paths: -------------- trunk/Client.cpp trunk/DCCBounce.cpp trunk/DCCSock.cpp trunk/FileUtils.cpp trunk/HTTPSock.cpp trunk/IRCSock.cpp trunk/Modules.cpp trunk/Template.cpp trunk/Utils.cpp trunk/modules/imapauth.cpp trunk/modules/modperl.cpp trunk/modules/saslauth.cpp trunk/modules/webadmin.cpp trunk/znc.cpp trunk/znc.h Modified: trunk/Client.cpp =================================================================== --- trunk/Client.cpp 2009-01-25 16:50:40 UTC (rev 1348) +++ trunk/Client.cpp 2009-01-25 16:51:54 UTC (rev 1349) @@ -65,7 +65,7 @@ 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::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::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::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 @@ return; } - DEBUG_ONLY(cout << "(" << m_pUser->GetUserName() << ") ZNC -> CLI [:" + m_pUser->GetStatusPrefix() + ((sModule.empty()) ? "status" : sModule) + "!zn...@zn... NOTICE " << GetNick() << " :" << sLine << "]" << endl); + DEBUG("(" << m_pUser->GetUserName() << ") ZNC -> CLI [:" + m_pUser->GetStatusPrefix() + ((sModule.empty()) ? "status" : sModule) + "!zn...@zn... NOTICE " << GetNick() << " :" << sLine << "]"); Write(":" + m_pUser->GetStatusPrefix() + ((sModule.empty()) ? "status" : sModule) + "!zn...@zn... NOTICE " + GetNick() + " :" + sLine + "\r\n"); } @@ -761,7 +761,7 @@ return; } - DEBUG_ONLY(cout << "(" << m_pUser->GetUserName() << ") ZNC -> CLI [:" + m_pUser->GetStatusPrefix() + ((sModule.empty()) ? "status" : sModule) + "!zn...@zn... PRIVMSG " << GetNick() << " :" << sLine << "]" << endl); + DEBUG("(" << m_pUser->GetUserName() << ") ZNC -> CLI [:" + m_pUser->GetStatusPrefix() + ((sModule.empty()) ? "status" : sModule) + "!zn...@zn... PRIVMSG " << GetNick() << " :" << sLine << "]"); Write(":" + m_pUser->GetStatusPrefix() + ((sModule.empty()) ? "status" : sModule) + "!zn...@zn... PRIVMSG " + GetNick() + " :" + sLine + "\r\n"); } Modified: trunk/DCCBounce.cpp =================================================================== --- trunk/DCCBounce.cpp 2009-01-25 16:50:40 UTC (rev 1348) +++ trunk/DCCBounce.cpp 2009-01-25 16:51:54 UTC (rev 1349) @@ -33,13 +33,13 @@ 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 @@ 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::Timeout() { - DEBUG_ONLY(cout << GetSockName() << " == Timeout()" << endl); + DEBUG(GetSockName() << " == Timeout()"); CString sType = (m_bIsChat) ? "Chat" : "Xfer"; if (IsRemote()) { @@ -87,7 +87,7 @@ } 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::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::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 @@ } void CDCCBounce::PutServ(const CString& sLine) { - DEBUG_ONLY(cout << GetSockName() << " -> [" << sLine << "]" << endl); + DEBUG(GetSockName() << " -> [" << sLine << "]"); Write(sLine + "\r\n"); } Modified: trunk/DCCSock.cpp =================================================================== --- trunk/DCCSock.cpp 2009-01-25 16:50:40 UTC (rev 1348) +++ trunk/DCCSock.cpp 2009-01-25 16:51:54 UTC (rev 1349) @@ -22,7 +22,7 @@ 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::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::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!"); Modified: trunk/FileUtils.cpp =================================================================== --- trunk/FileUtils.cpp 2009-01-25 16:50:40 UTC (rev 1348) +++ trunk/FileUtils.cpp 2009-01-25 16:51:54 UTC (rev 1349) @@ -206,7 +206,7 @@ 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 Modified: trunk/HTTPSock.cpp =================================================================== --- trunk/HTTPSock.cpp 2009-01-25 16:50:40 UTC (rev 1348) +++ trunk/HTTPSock.cpp 2009-01-25 16:51:54 UTC (rev 1349) @@ -99,7 +99,7 @@ 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 @@ 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 @@ } } - 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::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 @@ 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 @@ 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::ReachedMaxBuffer() { - DEBUG_ONLY(cout << GetSockName() << " == ReachedMaxBuffer()" << endl); + DEBUG(GetSockName() << " == ReachedMaxBuffer()"); Close(); } Modified: trunk/IRCSock.cpp =================================================================== --- trunk/IRCSock.cpp 2009-01-25 16:50:40 UTC (rev 1348) +++ trunk/IRCSock.cpp 2009-01-25 16:51:54 UTC (rev 1349) @@ -73,7 +73,7 @@ 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 @@ } 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::Connected() { - DEBUG_ONLY(cout << GetSockName() << " == Connected()" << endl); + DEBUG(GetSockName() << " == Connected()"); m_pUser->IRCConnected(this); CString sPass = m_sPass; @@ -817,7 +817,7 @@ 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 @@ 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::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::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::ReachedMaxBuffer() { - DEBUG_ONLY(cout << GetSockName() << " == ReachedMaxBuffer()" << endl); + DEBUG(GetSockName() << " == ReachedMaxBuffer()"); m_pUser->PutStatus("Received a too long line from the IRC server!"); Quit(); } Modified: trunk/Modules.cpp =================================================================== --- trunk/Modules.cpp 2009-01-25 16:50:40 UTC (rev 1348) +++ trunk/Modules.cpp 2009-01-25 16:51:54 UTC (rev 1349) @@ -128,7 +128,7 @@ } void CSocket::ReachedMaxBuffer() { - DEBUG_ONLY(cout << GetSockName() << " == ReachedMaxBuffer()" << endl); + DEBUG(GetSockName() << " == ReachedMaxBuffer()"); PutModule("Some socket reached its max buffer limit and was closed!"); Close(); } Modified: trunk/Template.cpp =================================================================== --- trunk/Template.cpp 2009-01-25 16:50:40 UTC (rev 1348) +++ trunk/Template.cpp 2009-01-25 16:51:54 UTC (rev 1349) @@ -34,7 +34,7 @@ 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 @@ 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(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 @@ } } - 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); Modified: trunk/Utils.cpp =================================================================== --- trunk/Utils.cpp 2009-01-25 16:50:40 UTC (rev 1348) +++ trunk/Utils.cpp 2009-01-25 16:51:54 UTC (rev 1349) @@ -491,7 +491,7 @@ return i; } - DEBUG_ONLY(cout << "CTable::GetColumnIndex(" + sName + ") failed" << endl); + DEBUG("CTable::GetColumnIndex(" + sName + ") failed"); return 0; } Modified: trunk/modules/imapauth.cpp =================================================================== --- trunk/modules/imapauth.cpp 2009-01-25 16:50:40 UTC (rev 1348) +++ trunk/modules/imapauth.cpp 2009-01-25 16:51:54 UTC (rev 1349) @@ -86,7 +86,7 @@ } 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 @@ 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; Modified: trunk/modules/modperl.cpp =================================================================== --- trunk/modules/modperl.cpp 2009-01-25 16:50:40 UTC (rev 1348) +++ trunk/modules/modperl.cpp 2009-01-25 16:51:54 UTC (rev 1349) @@ -282,7 +282,7 @@ sTmp[a] = ' '; } PutModule(sTmp); - DEBUG_ONLY(cerr << sTmp << endl); + DEBUG(sTmp); } CSockManager * GetSockManager() { return(m_pManager); } @@ -1051,7 +1051,7 @@ { if (!m_pUser) { - DEBUG_ONLY(cerr << "LoadPerlMod: No User is set!!!" << endl); + DEBUG("LoadPerlMod: No User is set!!!"); return; } @@ -1082,7 +1082,7 @@ 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 + "');"); Modified: trunk/modules/saslauth.cpp =================================================================== --- trunk/modules/saslauth.cpp 2009-01-25 16:50:40 UTC (rev 1348) +++ trunk/modules/saslauth.cpp 2009-01-25 16:51:54 UTC (rev 1349) @@ -62,17 +62,17 @@ 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); Modified: trunk/modules/webadmin.cpp =================================================================== --- trunk/modules/webadmin.cpp 2009-01-25 16:50:40 UTC (rev 1348) +++ trunk/modules/webadmin.cpp 2009-01-25 16:51:54 UTC (rev 1349) @@ -609,14 +609,14 @@ 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 @@ 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 @@ 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 << "]"); } } } Modified: trunk/znc.cpp =================================================================== --- trunk/znc.cpp 2009-01-25 16:50:40 UTC (rev 1348) +++ trunk/znc.cpp 2009-01-25 16:51:54 UTC (rev 1349) @@ -146,12 +146,12 @@ 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 @@ 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 @@ 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::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 @@ // 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 @@ } if (bUsersLeft == false) { - DEBUG_ONLY(cout << "ConnectUserTimer done" << endl); + DEBUG("ConnectUserTimer done"); CZNC::Get().DisableConnectUser(); } } Modified: trunk/znc.h =================================================================== --- trunk/znc.h 2009-01-25 16:50:40 UTC (rev 1348) +++ trunk/znc.h 2009-01-25 16:51:54 UTC (rev 1349) @@ -226,7 +226,7 @@ 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 @@ } 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. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |