diff --git a/Buffer.cpp b/Buffer.cpp index ab4c4b96..c2259e37 100644 --- a/Buffer.cpp +++ b/Buffer.cpp @@ -17,7 +17,7 @@ CBufLine::CBufLine(const CString& sPre, const CString& sPost, bool bIncNick=true CBufLine::~CBufLine() {} void CBufLine::GetLine(const CString& sTarget, CString& sRet) { - if(m_bIncNick) + if (m_bIncNick) sRet = m_sPre + sTarget + m_sPost; else sRet = m_sPre + m_sPost; @@ -43,8 +43,8 @@ int CBuffer::AddLine(const CString& sPre, const CString& sPost, bool bIncNick) { } int CBuffer::UpdateLine(const CString& sPre, const CString& sPost, bool bIncNick) { - for(iterator it = begin(); it != end(); it++) { - if(it->GetPre() == sPre) { + for (iterator it = begin(); it != end(); it++) { + if (it->GetPre() == sPre) { it->SetPost(sPost); it->SetIncNick(bIncNick); return size(); diff --git a/Chan.cpp b/Chan.cpp index 74914bcf..3dd59d50 100644 --- a/Chan.cpp +++ b/Chan.cpp @@ -107,7 +107,7 @@ void CChan::JoinUser(bool bForce, const CString& sKey, CClient* pClient) { pThisClient = pClient; for (map::iterator a = m_msNicks.begin(); a != m_msNicks.end(); a++) { - if(pThisClient->HasNamesx()) { + if (pThisClient->HasNamesx()) { sPerm = a->second->GetPermStr(); } else { char c = a->second->GetPermChar(); @@ -116,7 +116,7 @@ void CChan::JoinUser(bool bForce, const CString& sKey, CClient* pClient) { sPerm += c; } } - if(pThisClient->HasUHNames() && !a->second->GetIdent().empty() && !a->second->GetHost().empty()) { + if (pThisClient->HasUHNames() && !a->second->GetIdent().empty() && !a->second->GetHost().empty()) { sNick = a->first + "!" + a->second->GetIdent() + "@" + a->second->GetHost(); } else { sNick = a->first; @@ -444,19 +444,19 @@ bool CChan::AddNick(const CString& sNick) { pNick->SetUser(m_pUser); } - if(!sIdent.empty()) + if (!sIdent.empty()) pNick->SetIdent(sIdent); - if(!sHost.empty()) + if (!sHost.empty()) pNick->SetHost(sHost); - for(CString::size_type i = 0; i < sPrefix.length(); i++) { + for (CString::size_type i = 0; i < sPrefix.length(); i++) { if (pNick->AddPerm(sPrefix[i])) { IncPermCount(sPrefix[i]); } } if (pNick->GetNick().CaseCmp(m_pUser->GetCurNick()) == 0) { - for(CString::size_type i = 0; i < sPrefix.length(); i++) { + for (CString::size_type i = 0; i < sPrefix.length(); i++) { AddPerm(sPrefix[i]); } } diff --git a/Client.cpp b/Client.cpp index 25ce3af5..4137e481 100644 --- a/Client.cpp +++ b/Client.cpp @@ -247,10 +247,10 @@ void CClient::ReadLine(const CString& sData) { return; // Don't forward this msg. We don't want the client getting us disconnected. } else if (sCommand.CaseCmp("PROTOCTL") == 0) { unsigned int i = 1; - while(!sLine.Token(i).empty()) { - if(sLine.Token(i).CaseCmp("NAMESX") == 0) { + while (!sLine.Token(i).empty()) { + if (sLine.Token(i).CaseCmp("NAMESX") == 0) { m_bNamesx = true; - } else if(sLine.Token(i).CaseCmp("UHNAMES") == 0) { + } else if (sLine.Token(i).CaseCmp("UHNAMES") == 0) { m_bUHNames = true; } i++; diff --git a/FileUtils.cpp b/FileUtils.cpp index 5e980c4a..4b379d12 100644 --- a/FileUtils.cpp +++ b/FileUtils.cpp @@ -119,7 +119,7 @@ bool CFile::Exists(const CString& sFile) { unsigned long long CFile::GetSize(const CString& sFile) { struct stat st; - if(stat(sFile.c_str(), &st) != 0) { + if (stat(sFile.c_str(), &st) != 0) { return 0; } @@ -167,7 +167,7 @@ int CFile::Copy(const CString& sNewFileName, bool bOverwrite) { } bool CFile::Delete(const CString& sFileName) { - if(!CFile::Exists(sFileName)) { + if (!CFile::Exists(sFileName)) { return false; } @@ -175,7 +175,7 @@ bool CFile::Delete(const CString& sFileName) { } bool CFile::Move(const CString& sOldFileName, const CString& sNewFileName, bool bOverwrite) { - if((!bOverwrite) && (CFile::Exists(sNewFileName))) { + if ((!bOverwrite) && (CFile::Exists(sNewFileName))) { return false; } @@ -184,7 +184,7 @@ bool CFile::Move(const CString& sOldFileName, const CString& sNewFileName, bool } bool CFile::Copy(const CString& sOldFileName, const CString& sNewFileName, bool bOverwrite) { - if((!bOverwrite) && (CFile::Exists(sNewFileName))) { + if ((!bOverwrite) && (CFile::Exists(sNewFileName))) { return false; } @@ -277,7 +277,7 @@ bool CFile::ReadLine(CString& sData, const CString & sDelimiter) { bool bEOF = false; - while(true) { + while (true) { CString::size_type iFind = m_sBuffer.find(sDelimiter); if (iFind != CString::npos) { sData = m_sBuffer.substr(0, (iFind + 1)); diff --git a/HTTPSock.cpp b/HTTPSock.cpp index 810ca5e1..a66fc893 100644 --- a/HTTPSock.cpp +++ b/HTTPSock.cpp @@ -160,7 +160,7 @@ bool CHTTPSock::PrintFile(const CString& sFileName, CString sContentType) { char szBuf[4096]; int iLen = 0; - while((iLen = File.Read(szBuf, 4096)) > 0) { + while ((iLen = File.Read(szBuf, 4096)) > 0) { Write(szBuf, iLen); } diff --git a/IRCSock.cpp b/IRCSock.cpp index 176b426e..d7952f31 100644 --- a/IRCSock.cpp +++ b/IRCSock.cpp @@ -552,7 +552,7 @@ void CIRCSock::ReadLine(const CString& sData) { } else if (sCmd.CaseCmp("MODE") == 0) { CString sTarget = sRest.Token(0); CString sModes = sRest.Token(1, true); - if(sModes.Left(1) == ":") + if (sModes.Left(1) == ":") sModes = sModes.substr(1); CChan* pChan = m_pUser->FindChan(sTarget); @@ -579,7 +579,7 @@ void CIRCSock::ReadLine(const CString& sData) { } else if (uMode == '-') { bAdd = false; } else { - if(bAdd) { + if (bAdd) { m_scUserModes.insert(uMode); } else { m_scUserModes.erase(uMode); @@ -709,7 +709,7 @@ void CIRCSock::ReadLine(const CString& sData) { // :blub!dummy@rox-8DBEFE92 WALLOPS :this is a test CString sMsg = sRest.Token(0, true); - if(sMsg.Left(1) == ":") { + if (sMsg.Left(1) == ":") { sMsg.LeftChomp(); } @@ -848,7 +848,7 @@ bool CIRCSock::OnChanCTCP(CNick& Nick, const CString& sChan, CString& sMessage) // Record a /me if (sMessage.Left(7).CaseCmp("ACTION ") == 0) { sMessage = sMessage.substr(7); - if(pChan->KeepBuffer() || !m_pUser->IsUserAttached()) { + if (pChan->KeepBuffer() || !m_pUser->IsUserAttached()) { pChan->AddBuffer(":" + Nick.GetNickMask() + " PRIVMSG " + sChan + " :\001ACTION " + m_pUser->AddTimestamp(sMessage) + "\001"); } MODULECALL(OnChanAction(Nick, *pChan, sMessage), m_pUser, NULL, return true); diff --git a/String.cpp b/String.cpp index 5b92413f..b4a05a64 100644 --- a/String.cpp +++ b/String.cpp @@ -1023,7 +1023,7 @@ CString& MCString::Decode(CString& sValue) { char *endptr; CString sTmp; - while(*pTmp) { + while (*pTmp) { if (*pTmp != '%') { sTmp += *pTmp++; } else { diff --git a/User.cpp b/User.cpp index 79182f95..3ebf29a5 100644 --- a/User.cpp +++ b/User.cpp @@ -148,7 +148,7 @@ CString& CUser::AddTimestamp(const CString& sStr, CString& sRet) const { char szTimestamp[1024]; time_t tm; - if(GetTimestampFormat().empty() || (!m_bAppendTimestamp && !m_bPrependTimestamp)) { + if (GetTimestampFormat().empty() || (!m_bAppendTimestamp && !m_bPrependTimestamp)) { sRet = sStr; } else { time(&tm); @@ -207,14 +207,14 @@ void CUser::UserConnected(CClient* pClient) { } } - if(GetIRCSock() != NULL) { + if (GetIRCSock() != NULL) { CString sUserMode(""); const set& scUserModes = GetIRCSock()->GetUserModes(); for (set::iterator it = scUserModes.begin(); it != scUserModes.end(); it++) { sUserMode += *it; } - if(!sUserMode.empty()) { + if (!sUserMode.empty()) { pClient->PutClient(":" + GetIRCNick().GetNick() + " MODE " + GetIRCNick().GetNick() + " :+" + sUserMode); } } @@ -989,7 +989,7 @@ bool CUser::IsChan(const CString& sChan) const { return false; // There is no way this is a chan if (GetChanPrefixes().empty()) return true; // We can't know, so we allow everything - // Thanks to the above if(empty), we can do sChan[0] + // Thanks to the above if (empty), we can do sChan[0] return GetChanPrefixes().find(sChan[0]) != CString::npos; } diff --git a/Utils.cpp b/Utils.cpp index e5a5407e..89eb878e 100644 --- a/Utils.cpp +++ b/Utils.cpp @@ -66,7 +66,7 @@ void CUtils::GenerateCert(FILE *pOut, bool bEncPrivKey, const CString& sHost) { PEM_write_RSAPrivateKey(pOut, pRSA, (bEncPrivKey ? EVP_des_ede3_cbc() : NULL), NULL, 0, NULL, NULL); - if(!(pCert = X509_new())) { + if (!(pCert = X509_new())) { EVP_PKEY_free(pKey); return; } @@ -619,7 +619,7 @@ CString CBlowfish::MD5(const CString & sInput, bool bHexEncode) { if (!bHexEncode) { sRet.append((const char *)data, MD5_DIGEST_LENGTH); } else { - for(int a = 0; a < MD5_DIGEST_LENGTH; a++) { + for (int a = 0; a < MD5_DIGEST_LENGTH; a++) { sRet += g_HexDigits[data[a] >> 4]; sRet += g_HexDigits[data[a] & 0xf]; } diff --git a/Utils.h b/Utils.h index 2803c0e0..be29cfbe 100644 --- a/Utils.h +++ b/Utils.h @@ -258,7 +258,7 @@ inline bool ReadFile(const CString & sFilename, CString & sLine) { return false; } - while((bytes = fread(inbuff, sizeof(char), RF_BUFF, f)) > 0) { + while ((bytes = fread(inbuff, sizeof(char), RF_BUFF, f)) > 0) { sLine.append(inbuff, bytes); } @@ -310,7 +310,7 @@ inline bool ReadLine(const CString & sData, CString & sLine, CString::size_type inline CString Lower(const CString & sLine) { CString sRet; - for(u_int a = 0; a < sLine.length(); a++) { + for (u_int a = 0; a < sLine.length(); a++) { sRet += tolower(sLine[a]); } @@ -319,7 +319,7 @@ inline CString Lower(const CString & sLine) { inline CString Upper(const CString & sLine) { CString sRet; - for(u_int a = 0; a < sLine.length(); a++) { + for (u_int a = 0; a < sLine.length(); a++) { sRet += toupper(sLine[a]); } diff --git a/modules/away.cpp b/modules/away.cpp index c12dc3f6..874f8c7a 100644 --- a/modules/away.cpp +++ b/modules/away.cpp @@ -90,7 +90,7 @@ public: virtual void OnIRCConnected() { - if(m_bIsAway) + if (m_bIsAway) Away(true); // reset away if we are reconnected else Back(); // ircd seems to remember your away if you killed the client and came back @@ -103,7 +103,7 @@ public: { CString sLine; CString::size_type iPos = 0; - while(ReadLine(sFile, sLine, iPos)) + while (ReadLine(sFile, sLine, iPos)) { sLine.Trim(); AddMessage(sLine); @@ -124,7 +124,7 @@ public: { CString sFile = CRYPT_VERIFICATION_TOKEN; - for(u_int b = 0; b < m_vMessages.size(); b++) + for (u_int b = 0; b < m_vMessages.size(); b++) sFile += m_vMessages[b] + "\n"; CBlowfish c(m_sPassword, BF_ENCRYPT); @@ -153,7 +153,7 @@ public: if (sCmdName == "away") { CString sReason; - if(sCommand.Token(1) != "-quiet") + if (sCommand.Token(1) != "-quiet") { sReason = sCommand.Token(1, true); PutModNotice("You have been marked as away", "away"); @@ -170,7 +170,7 @@ public: } else if (sCmdName == "messages") { - for(u_int a = 0; a < m_vMessages.size(); a++) + for (u_int a = 0; a < m_vMessages.size(); a++) PutModule(m_vMessages[a], "away"); } else if (sCmdName == "delete") @@ -179,7 +179,7 @@ public: if (sWhich == "all") { PutModNotice("Deleted " + CString(m_vMessages.size()) + " Messages.", "away"); - for(u_int a = 0; a < m_vMessages.size(); a++) + for (u_int a = 0; a < m_vMessages.size(); a++) m_vMessages.erase(m_vMessages.begin() + a--); } @@ -222,7 +222,7 @@ public: else if (sCmdName == "show") { map< CString, vector< CString> > msvOutput; - for(u_int a = 0; a < m_vMessages.size(); a++) + for (u_int a = 0; a < m_vMessages.size(); a++) { CString sTime = m_vMessages[a].Token(0, false, ":"); CString sWhom = m_vMessages[a].Token(1, false, ":"); @@ -252,10 +252,10 @@ public: sTmp += sMessage; msvOutput[sWhom].push_back(sTmp); } - for(map< CString, vector< CString> >::iterator it = msvOutput.begin(); it != msvOutput.end(); it++) + for (map< CString, vector< CString> >::iterator it = msvOutput.begin(); it != msvOutput.end(); it++) { PutModule(it->first, "away"); - for(u_int a = 0; a < it->second.size(); a++) + for (u_int a = 0; a < it->second.size(); a++) PutModule(it->second[a]); } PutModule("#--- End Messages", "away"); @@ -273,7 +273,7 @@ public: SetAwayTime(iSetting); - if(iSetting == 0) + if (iSetting == 0) PutModule("Timer disabled"); else PutModule("Timer set to " + CString(iSetting) + " seconds"); @@ -349,7 +349,7 @@ public: virtual EModRet OnUserNotice(CString& sTarget, CString& sMessage) { Ping(); - if(m_bIsAway) + if (m_bIsAway) Back(); return(CONTINUE); @@ -357,7 +357,7 @@ public: virtual EModRet OnUserMsg(CString& sTarget, CString& sMessage) { Ping(); - if(m_bIsAway) + if (m_bIsAway) Back(); return(CONTINUE); diff --git a/modules/awaynick.cpp b/modules/awaynick.cpp index a7af2c2b..3573544f 100644 --- a/modules/awaynick.cpp +++ b/modules/awaynick.cpp @@ -147,7 +147,7 @@ public: PutModule(sMsg); } - } else if(sCommand.Token(0).CaseCmp("HELP") == 0) { + } else if (sCommand.Token(0).CaseCmp("HELP") == 0) { PutModule("Commands are: show, timers, set [awaynick]"); } } diff --git a/modules/email.cpp b/modules/email.cpp index f7dfcaf8..03fbc5b2 100644 --- a/modules/email.cpp +++ b/modules/email.cpp @@ -48,7 +48,7 @@ public: virtual ~CEmail() { vector vSocks = m_pManager->FindSocksByName("EMAIL::" + m_pUser->GetUserName()); - for(u_int a = 0; a < vSocks.size(); a++) + for (u_int a = 0; a < vSocks.size(); a++) m_pManager->DelSockByAddr(vSocks[a]); } @@ -91,7 +91,7 @@ public: if (!m_bInitialized) { m_bInitialized = true; - for(u_int a = 0; a < vEmails.size(); a++) + for (u_int a = 0; a < vEmails.size(); a++) m_ssUidls.insert(vEmails[a].sUidl); stringstream s; @@ -106,7 +106,7 @@ public: Table.AddColumn("Size"); Table.AddColumn("Subject"); - for(u_int a = 0; a < vEmails.size(); a++) + for (u_int a = 0; a < vEmails.size(); a++) { if (m_ssUidls.find(vEmails[a].sUidl) == m_ssUidls.end()) { @@ -180,7 +180,7 @@ public: tmp.sUidl = (char *)CMD5(m_sMailBuffer.substr(0, 255)); CString sLine; CString::size_type iPos = 0; - while(::ReadLine(m_sMailBuffer, sLine, iPos)) + while (::ReadLine(m_sMailBuffer, sLine, iPos)) { sLine.Trim(); if (sLine.empty()) diff --git a/modules/modperl.cpp b/modules/modperl.cpp index 4dedfcec..bfdf8b5e 100644 --- a/modules/modperl.cpp +++ b/modules/modperl.cpp @@ -102,7 +102,7 @@ public: { HV *pHash = newHV(); sv_2mortal((SV *) pHash); - for(CPerlHash::iterator it = this->begin(); it != this->end(); it++) + for (CPerlHash::iterator it = this->begin(); it != this->end(); it++) { SV *pSV = it->second.GetSV(false); hv_store(pHash, it->first.c_str(), it->first.length(), pSV, 0); @@ -220,7 +220,7 @@ public: { const map & msUsers = CZNC::Get().GetUserMap(); - for(map::const_iterator it = msUsers.begin(); it != msUsers.end(); it++) + for (map::const_iterator it = msUsers.begin(); it != msUsers.end(); it++) { // need to set it on all of these m_pUser = it->second; CBNone("OnShutdown"); @@ -248,7 +248,7 @@ public: CFile cFile(sModule); if ((cFile.Exists()) && (cFile.Open(O_RDONLY))) { - while(cFile.ReadLine(sBuffer)) + while (cFile.ReadLine(sBuffer)) sScript += sBuffer; cFile.Close(); @@ -262,7 +262,7 @@ public: if ((sName.CaseCmp("loadperlmodule") == 0) && (pUser)) { m_pUser = pUser; - if(sValue.Right(3) == ".pm") + if (sValue.Right(3) == ".pm") LoadPerlMod(sValue); else LoadPerlMod(sValue + ".pm"); @@ -275,7 +275,7 @@ public: void DumpError(const CString & sError) { CString sTmp = sError; - for(CString::size_type a = 0; a < sTmp.size(); a++) + for (CString::size_type a = 0; a < sTmp.size(); a++) { if (isspace(sTmp[a])) sTmp[a] = ' '; @@ -345,7 +345,7 @@ public: VPString vsArgs; vsArgs.push_back(Nick.GetNickMask()); vsArgs.push_back(sMessage); - for(vector::size_type a = 0; a < vChans.size(); a++) + for (vector::size_type a = 0; a < vChans.size(); a++) vsArgs.push_back(vChans[a]->GetName()); CallBack("OnQuit", vsArgs); @@ -356,7 +356,7 @@ public: VPString vsArgs; vsArgs.push_back(Nick.GetNickMask()); vsArgs.push_back(sNewNick); - for(vector::size_type a = 0; a < vChans.size(); a++) + for (vector::size_type a = 0; a < vChans.size(); a++) vsArgs.push_back(vChans[a]->GetName()); CallBack("OnNick", vsArgs); @@ -474,7 +474,7 @@ public: { CString sCommand = sLine.Token(0); - if(sCommand.CaseCmp("loadperlmod", 11) == 0 || sCommand.CaseCmp("unloadperlmod", 13) == 0 || sCommand.CaseCmp("reloadperlmod", 13) == 0) + if (sCommand.CaseCmp("loadperlmod", 11) == 0 || sCommand.CaseCmp("unloadperlmod", 13) == 0 || sCommand.CaseCmp("reloadperlmod", 13) == 0) { CString sModule = sLine.Token(1); if (sModule.Right(3) != ".pm") @@ -662,7 +662,7 @@ XS(XS_ZNC_GetNicks) const map< CString,CNick* > & mscNicks = pChan->GetNicks(); - for(map< CString,CNick* >::const_iterator it = mscNicks.begin(); it != mscNicks.end(); it++) + for (map< CString,CNick* >::const_iterator it = mscNicks.begin(); it != mscNicks.end(); it++) { CNick & cNick = *(it->second); CPerlHash cHash; @@ -693,7 +693,7 @@ XS(XS_ZNC_GetString) PString sReturn; CString sName = (char *)SvPV(ST(0),PL_na); - if(sName == "UserName") sReturn = pUser->GetUserName(); + if (sName == "UserName") sReturn = pUser->GetUserName(); else if (sName == "Nick") sReturn = pUser->GetNick(); else if (sName == "AltNick") sReturn = pUser->GetAltNick(); else if (sName == "Ident") sReturn = pUser->GetIdent(); @@ -946,7 +946,7 @@ CModPerl::EModRet CModPerl::CallBack(const PString & sHookName, const VPString & else sFuncToCall = ZNCCallSockCB; } - for(VPString::size_type a = 0; a < vsArgs.size(); a++) + for (VPString::size_type a = 0; a < vsArgs.size(); a++) XPUSHs(vsArgs[a].GetSV()); PUTBACK; @@ -1054,7 +1054,7 @@ void CModPerl::LoadPerlMod(const CString & sModule) void CModPerl::DestroyAllSocks(const CString & sModuleName) { - for(u_int a = 0; a < m_pManager->size(); a++) + for (u_int a = 0; a < m_pManager->size(); a++) { if ((*m_pManager)[a]->GetSockName() == ZNCSOCK) { diff --git a/modules/nickserv.cpp b/modules/nickserv.cpp index 5e4ca3c4..96589cd8 100644 --- a/modules/nickserv.cpp +++ b/modules/nickserv.cpp @@ -32,16 +32,16 @@ public: virtual void OnModCommand(const CString& sCommand) { CString sCmdName = sCommand.Token(0).AsLower(); - if(sCmdName == "set") { + if (sCmdName == "set") { CString sPass = sCommand.Token(1, true); m_sPass = sPass; PutModule("Password set"); - } else if(sCmdName == "show") { + } else if (sCmdName == "show") { if (m_sPass.empty()) PutModule("No password set"); else PutModule("Current password: " + m_sPass); - } else if(sCmdName == "save") { + } else if (sCmdName == "save") { SetNV("Password", m_sPass); PutModule("Saved!"); } else { diff --git a/modules/partyline.cpp b/modules/partyline.cpp index 930a13d2..ce3bdebe 100644 --- a/modules/partyline.cpp +++ b/modules/partyline.cpp @@ -41,7 +41,7 @@ public: GLOBALMODCONSTRUCTOR(CPartylineMod) {} virtual ~CPartylineMod() { - while(m_ssChannels.size()) { + while (m_ssChannels.size()) { delete *m_ssChannels.begin(); m_ssChannels.erase(m_ssChannels.begin()); } @@ -87,13 +87,13 @@ public: CPartylineChannel* pChannel; it->second.Split(",", vsChannels, false); - if(!pUser) { + if (!pUser) { // TODO: give some usefull message? continue; } - for(VCString::iterator i = vsChannels.begin(); i != vsChannels.end(); i++) { - if(i->Trim_n().empty()) + for (VCString::iterator i = vsChannels.begin(); i != vsChannels.end(); i++) { + if (i->Trim_n().empty()) continue; pChannel = GetChannel(*i); JoinUser(pUser, pChannel); @@ -108,7 +108,7 @@ public: CString sChans; const CString &sUser = pUser->GetUserName(); - for(set::iterator it = m_ssChannels.begin(); + for (set::iterator it = m_ssChannels.begin(); it != m_ssChannels.end(); it++) { if ((*it)->IsFixedChan(sUser)) { sChans += "," + (*it)->GetName(); @@ -449,7 +449,7 @@ public: PutModule(sTmp); } } else if (sCommand.CaseCmp("ADDFIXCHAN") == 0) { - if(!m_pUser->IsAdmin()) { + if (!m_pUser->IsAdmin()) { PutModule("Access denied"); return; } @@ -458,12 +458,12 @@ public: CUser* pUser = CZNC::Get().FindUser(sUser); CPartylineChannel* pChan; - if(sChan.Left(2) != "~#") { + if (sChan.Left(2) != "~#") { PutModule("Invalid channel name"); return; } - if(pUser == NULL) { + if (pUser == NULL) { PutModule("Unknown User '" + sUser + "'"); return; } @@ -476,7 +476,7 @@ public: PutModule("Fixed " + sUser + " to channel " + sChan); } else if (sCommand.CaseCmp("DELFIXCHAN") == 0) { - if(!m_pUser->IsAdmin()) { + if (!m_pUser->IsAdmin()) { PutModule("Access denied"); return; } @@ -485,12 +485,12 @@ public: CUser* pUser = CZNC::Get().FindUser(sUser); CPartylineChannel* pChan = FindChannel(sChan); - if(pUser == NULL) { + if (pUser == NULL) { PutModule("Unknown User '" + sUser + "'"); return; } - if(!pChan || !pChan->IsFixedChan(sUser)) { + if (!pChan || !pChan->IsFixedChan(sUser)) { PutModule(sUser + " is not in " + sChan + " or isnt fixed to it"); return; } @@ -501,38 +501,38 @@ public: PutModule("Removed " + sUser + " from " + sChan); } else if (sCommand.CaseCmp("LISTFIXCHANS") == 0) { - if(!m_pUser->IsAdmin()) { + if (!m_pUser->IsAdmin()) { PutModule("Access denied"); return; } CString sUser = sLine.Token(1); CUser* pUser = CZNC::Get().FindUser(sUser); - if(!pUser) { + if (!pUser) { PutModule("User not found!"); return; } for (set::const_iterator a = m_ssChannels.begin(); a != m_ssChannels.end(); a++) { - if((*a)->IsFixedChan(sUser)) { + if ((*a)->IsFixedChan(sUser)) { PutModule((*a)->GetName()); } } PutModule("--- End of list"); } else if (sCommand.CaseCmp("LISTFIXUSERS") == 0) { - if(!m_pUser->IsAdmin()) { + if (!m_pUser->IsAdmin()) { PutModule("Access denied"); return; } CString sChan = sLine.Token(1).Left(32); CPartylineChannel* pChan = FindChannel(sChan); - if(!pChan) { + if (!pChan) { PutModule("Channel does not exist!"); return; } const set& sNicks = pChan->GetNicks(); - for(set::const_iterator it = sNicks.begin(); it != sNicks.end(); it++) { - if(pChan->IsFixedChan(*it)) { + for (set::const_iterator it = sNicks.begin(); it != sNicks.end(); it++) { + if (pChan->IsFixedChan(*it)) { PutModule(*it); } } @@ -556,9 +556,9 @@ public: void PutChan(const set& ssNicks, const CString& sLine, bool bIncludeCurUser = true, bool bIncludeClient = true, CUser* pUser = NULL, CClient* pClient = NULL) { const map& msUsers = CZNC::Get().GetUserMap(); - if(!pUser) + if (!pUser) pUser = m_pUser; - if(!pClient) + if (!pClient) pClient = m_pClient; for (map::const_iterator it = msUsers.begin(); it != msUsers.end(); it++) { @@ -601,8 +601,8 @@ public: CPartylineChannel* FindChannel(const CString& sChan) { CString sChannel = sChan.AsLower(); - for(set::iterator it = m_ssChannels.begin(); it != m_ssChannels.end(); it++) { - if((*it)->GetName().AsLower() == sChannel) + for (set::iterator it = m_ssChannels.begin(); it != m_ssChannels.end(); it++) { + if ((*it)->GetName().AsLower() == sChannel) return *it; } @@ -612,7 +612,7 @@ public: CPartylineChannel* GetChannel(const CString& sChannel) { CPartylineChannel* pChannel = FindChannel(sChannel); - if(pChannel == NULL) { + if (pChannel == NULL) { pChannel = new CPartylineChannel(sChannel.AsLower()); m_ssChannels.insert(pChannel); } diff --git a/modules/perform.cpp b/modules/perform.cpp index 25f4f9f4..d67ac223 100644 --- a/modules/perform.cpp +++ b/modules/perform.cpp @@ -29,17 +29,17 @@ public: virtual void OnModCommand(const CString& sCommand) { CString sCmdName = sCommand.Token(0).AsLower(); - if(sCmdName == "add") + if (sCmdName == "add") { CString sPerf = sCommand.Token(1, true); - if(sPerf.Left(1) == "/") + if (sPerf.Left(1) == "/") sPerf.LeftChomp(); - if(sPerf.Token(0).CaseCmp("MSG") == 0) { + if (sPerf.Token(0).CaseCmp("MSG") == 0) { sPerf = "PRIVMSG " + sPerf.Token(1, true); } - if((sPerf.Token(0).CaseCmp("PRIVMSG") == 0 || + if ((sPerf.Token(0).CaseCmp("PRIVMSG") == 0 || sPerf.Token(0).CaseCmp("NOTICE") == 0) && sPerf.Token(2).Left(1) != ":") { sPerf = sPerf.Token(0) + " " + sPerf.Token(1) @@ -48,7 +48,7 @@ public: m_vPerform.push_back(sPerf); PutModule("Added!"); Save(); - } else if(sCmdName == "del") + } else if (sCmdName == "del") { u_int iNum = atoi(sCommand.Token(1, true).c_str()); if (iNum > m_vPerform.size() || iNum <= 0) @@ -62,14 +62,14 @@ public: PutModule("Command Erased."); } Save(); - } else if(sCmdName == "list") + } else if (sCmdName == "list") { int i = 1; CString sExpanded; - for(VCString::iterator it = m_vPerform.begin(); it != m_vPerform.end(); it++, i++) + for (VCString::iterator it = m_vPerform.begin(); it != m_vPerform.end(); it++, i++) { sExpanded = GetUser()->ExpandString(*it); - if(sExpanded != *it) + if (sExpanded != *it) PutModule(CString(i) + ": " + *it + " (" + sExpanded + ")"); else PutModule(CString(i) + ": " + *it); @@ -83,7 +83,7 @@ public: virtual void OnIRCConnected() { - for(VCString::iterator it = m_vPerform.begin(); + for (VCString::iterator it = m_vPerform.begin(); it != m_vPerform.end(); it++) { PutIRC(GetUser()->ExpandString(*it)); @@ -95,7 +95,7 @@ private: { CString sBuffer = ""; - for(VCString::iterator it = m_vPerform.begin(); it != m_vPerform.end(); it++) + for (VCString::iterator it = m_vPerform.begin(); it != m_vPerform.end(); it++) { sBuffer += *it + "\n"; } diff --git a/modules/savebuff.cpp b/modules/savebuff.cpp index dd96fa44..f8006d78 100644 --- a/modules/savebuff.cpp +++ b/modules/savebuff.cpp @@ -80,7 +80,7 @@ public: } const vector& vChans = m_pUser->GetChans(); - for(u_int a = 0; a < vChans.size(); a++) + for (u_int a = 0; a < vChans.size(); a++) { if (!vChans[a]->KeepBuffer()) continue; @@ -105,7 +105,7 @@ public: CString sLine; CString::size_type iPos = 0; - while(ReadLine(sFile, sLine, iPos)) + while (ReadLine(sFile, sLine, iPos)) { sLine.Trim(); pChan->AddBuffer(sLine); @@ -125,7 +125,7 @@ public: if (!m_sPassword.empty()) { const vector& vChans = m_pUser->GetChans(); - for(u_int a = 0; a < vChans.size(); a++) + for (u_int a = 0; a < vChans.size(); a++) { if (!vChans[a]->KeepBuffer()) continue; @@ -142,7 +142,7 @@ public: CString sFile = CRYPT_VERIFICATION_TOKEN; - for(u_int b = 0; b < vBuffer.size(); b++) + for (u_int b = 0; b < vBuffer.size(); b++) sFile += vBuffer[b] + "\n"; CBlowfish c(m_sPassword, BF_ENCRYPT); @@ -181,7 +181,7 @@ public: { CString sLine; iPos = 0; - while(ReadLine(sFile, sLine, iPos)) + while (ReadLine(sFile, sLine, iPos)) { sLine.Trim(); PutModule("[" + sLine + "]"); @@ -209,7 +209,7 @@ public: { CString sLine; CString::size_type iPos = 0; - while(ReadLine(sFile, sLine, iPos)) + while (ReadLine(sFile, sLine, iPos)) { sLine.Trim(); PutUser(sLine); @@ -241,7 +241,7 @@ public: } virtual void OnQuit(const CNick& cNick, const CString& sMessage, const vector& vChans) { - for(u_int a = 0; a < vChans.size(); a++) + for (u_int a = 0; a < vChans.size(); a++) { if (!vChans[a]->KeepBuffer()) continue; @@ -253,7 +253,7 @@ public: virtual void OnNick(const CNick& cNick, const CString& sNewNick, const vector& vChans) { - for(u_int a = 0; a < vChans.size(); a++) + for (u_int a = 0; a < vChans.size(); a++) { if (!vChans[a]->KeepBuffer()) continue; diff --git a/modules/schat.cpp b/modules/schat.cpp index e1ce2f32..461502cd 100644 --- a/modules/schat.cpp +++ b/modules/schat.cpp @@ -98,7 +98,7 @@ public: virtual void DumpBuffer() { - for(vector::reverse_iterator it = m_vBuffer.rbegin(); it != m_vBuffer.rend(); it++) + for (vector::reverse_iterator it = m_vBuffer.rbegin(); it != m_vBuffer.rend(); it++) ReadLine(*it); m_vBuffer.clear(); @@ -136,7 +136,7 @@ public: virtual void OnUserAttached() { CString sName = "SCHAT::" + m_pUser->GetUserName(); - for(u_int a = 0; a < m_pManager->size(); a++) + for (u_int a = 0; a < m_pManager->size(); a++) { if ((*m_pManager)[a]->GetSockName() != sName.c_str() || ((*m_pManager)[a]->GetType() == CSChatSock::LISTENER)) @@ -150,7 +150,7 @@ public: void CleanSocks() { CString sName = "SCHAT::" + m_pUser->GetUserName(); - for(u_int a= 0; a < m_pManager->size(); a++) + for (u_int a= 0; a < m_pManager->size(); a++) { if ((*m_pManager)[a]->GetSockName() == sName) m_pManager->DelSock(a--); @@ -185,7 +185,7 @@ public: if ((sCom.CaseCmp("chat") == 0) && (!sArgs.empty())) { CString sSockName = "SCHAT::" + m_pUser->GetUserName(); CString sNick = "(s)" + sArgs; - for(u_int a= 0; a < m_pManager->size(); a++) + for (u_int a= 0; a < m_pManager->size(); a++) { if ((*m_pManager)[a]->GetSockName() != sSockName) continue; @@ -231,7 +231,7 @@ public: Table.AddColumn("Port"); Table.AddColumn("Status"); Table.AddColumn("Cipher"); - for(u_int a= 0; a < m_pManager->size(); a++) + for (u_int a= 0; a < m_pManager->size(); a++) { if ((*m_pManager)[a]->GetSockName() != sName) continue; @@ -277,7 +277,7 @@ public: } else if (sCom.CaseCmp("close") == 0) { CString sName = "SCHAT::" + m_pUser->GetUserName(); - for(u_int a = 0; a < m_pManager->size(); a++) + for (u_int a = 0; a < m_pManager->size(); a++) { if ((*m_pManager)[a]->GetSockName() != sName) continue; @@ -302,7 +302,7 @@ public: Table.AddColumn("RemoteIP:Port"); Table.AddColumn("Type"); Table.AddColumn("Cipher"); - for(u_int a = 0; a < m_pManager->size(); a++) + for (u_int a = 0; a < m_pManager->size(); a++) { Table.AddRow(); Csock *pSock = (*m_pManager)[a]; diff --git a/modules/stickychan.cpp b/modules/stickychan.cpp index cfbc2e26..d477ec86 100644 --- a/modules/stickychan.cpp +++ b/modules/stickychan.cpp @@ -59,7 +59,7 @@ public: else if ((sCmdName == "list") && (sChannel.empty())) { int i = 1; - for(MCString::iterator it = BeginNV(); it != EndNV(); it++, i++) + for (MCString::iterator it = BeginNV(); it != EndNV(); it++, i++) { if (it->second.empty()) PutModule(CString(i) + ": " + it->first); @@ -76,7 +76,7 @@ public: virtual void RunJob() { - for(MCString::iterator it = BeginNV(); it != EndNV(); it++) + for (MCString::iterator it = BeginNV(); it != EndNV(); it++) { if (!m_pUser->FindChan(it->first)) { diff --git a/znc.cpp b/znc.cpp index 9307f66e..a3e9bf52 100644 --- a/znc.cpp +++ b/znc.cpp @@ -39,7 +39,7 @@ CZNC::CZNC() { } CZNC::~CZNC() { - if(m_pISpoofLockFile) + if (m_pISpoofLockFile) ReleaseISpoof(); #ifdef _MODULES @@ -226,12 +226,12 @@ int CZNC::Loop() { } bool CZNC::WriteISpoof(CUser* pUser) { - if(m_pISpoofLockFile != NULL) + if (m_pISpoofLockFile != NULL) return false; if (!m_sISpoofFile.empty()) { m_pISpoofLockFile = new CLockFile; - if(!m_pISpoofLockFile->TryExLock(m_sISpoofFile, true)) { + if (!m_pISpoofLockFile->TryExLock(m_sISpoofFile, true)) { delete m_pISpoofLockFile; m_pISpoofLockFile = NULL; return false; @@ -257,7 +257,7 @@ bool CZNC::WriteISpoof(CUser* pUser) { } void CZNC::ReleaseISpoof() { - if(m_pISpoofLockFile == NULL) + if (m_pISpoofLockFile == NULL) return; if (!m_sISpoofFile.empty()) { @@ -563,7 +563,7 @@ bool CZNC::WriteNewConfig(const CString& sConfig) { // Listen unsigned int uPort = 0; - while(!CUtils::GetNumInput("What port would you like ZNC to listen on?", uPort, 1, 65535)) ; + while (!CUtils::GetNumInput("What port would you like ZNC to listen on?", uPort, 1, 65535)) ; CString sSSL; #ifdef HAVE_LIBSSL @@ -749,8 +749,8 @@ bool CZNC::WriteNewConfig(const CString& sConfig) { bool bSSL = false; uPort = 0; - while(!CUtils::GetInput("IRC server", sHost, "", "host only") || !CServer::IsValidHostName(sHost)) ; - while(!CUtils::GetNumInput("[" + sHost + "] Port", uPort, 1, 65535, 6667)) ; + while (!CUtils::GetInput("IRC server", sHost, "", "host only") || !CServer::IsValidHostName(sHost)) ; + while (!CUtils::GetNumInput("[" + sHost + "] Port", uPort, 1, 65535, 6667)) ; CUtils::GetInput("[" + sHost + "] Password (probably empty)", sPass); #ifdef HAVE_LIBSSL @@ -1213,14 +1213,14 @@ bool CZNC::DoRehash(CString& sError) pUser->SetTimestampPrepend(sValue.ToBool()); continue; } else if (sName.CaseCmp("Timestamp") == 0) { - if(sValue.Trim_n().CaseCmp("true") != 0) { - if(sValue.Trim_n().CaseCmp("append") == 0) { + if (sValue.Trim_n().CaseCmp("true") != 0) { + if (sValue.Trim_n().CaseCmp("append") == 0) { pUser->SetTimestampAppend(true); pUser->SetTimestampPrepend(false); - } else if(sValue.Trim_n().CaseCmp("prepend") == 0) { + } else if (sValue.Trim_n().CaseCmp("prepend") == 0) { pUser->SetTimestampAppend(false); pUser->SetTimestampPrepend(true); - } else if(sValue.Trim_n().CaseCmp("false") == 0) { + } else if (sValue.Trim_n().CaseCmp("false") == 0) { pUser->SetTimestampAppend(false); pUser->SetTimestampPrepend(false); } else { @@ -1377,7 +1377,7 @@ bool CZNC::DoRehash(CString& sError) m_sISpoofFormat = sValue; continue; } else if (sName.CaseCmp("ISpoofFile") == 0) { - if(sValue.Left(2) == "~/") { + if (sValue.Left(2) == "~/") { sValue.LeftChomp(2); sValue = GetHomePath() + "/" + sValue; }