mirror of
https://github.com/znc/znc.git
synced 2026-05-10 07:14:43 +02:00
Fix a bunch of style suggestions from cppcheck[1]
Thanks to DarthGandalf for this patch. You must be bored. :P [1] cppcheck.sf.net git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1776 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
+2
-2
@@ -43,7 +43,7 @@ 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++) {
|
||||
for (iterator it = begin(); it != end(); ++it) {
|
||||
if (it->GetPre() == sPre) {
|
||||
it->SetPost(sPost);
|
||||
it->SetIncNick(bIncNick);
|
||||
@@ -55,7 +55,7 @@ int CBuffer::UpdateLine(const CString& sPre, const CString& sPost, bool bIncNick
|
||||
}
|
||||
|
||||
int CBuffer::UpdateExactLine(const CString& sPre, const CString& sPost, bool bIncNick) {
|
||||
for (iterator it = begin(); it != end(); it++) {
|
||||
for (iterator it = begin(); it != end(); ++it) {
|
||||
if (it->GetPre() == sPre && it->GetPost() == sPost)
|
||||
return size();
|
||||
}
|
||||
|
||||
@@ -111,14 +111,14 @@ void CChan::JoinUser(bool bForce, const CString& sKey, CClient* pClient) {
|
||||
CString sPerm, sNick;
|
||||
|
||||
vector<CClient*>& vpClients = m_pUser->GetClients();
|
||||
for (vector<CClient*>::iterator it = vpClients.begin(); it != vpClients.end(); it++) {
|
||||
for (vector<CClient*>::iterator it = vpClients.begin(); it != vpClients.end(); ++it) {
|
||||
CClient* pThisClient;
|
||||
if (!pClient)
|
||||
pThisClient = *it;
|
||||
else
|
||||
pThisClient = pClient;
|
||||
|
||||
for (map<CString,CNick*>::iterator a = m_msNicks.begin(); a != m_msNicks.end(); a++) {
|
||||
for (map<CString,CNick*>::iterator a = m_msNicks.begin(); a != m_msNicks.end(); ++a) {
|
||||
if (pThisClient->HasNamesx()) {
|
||||
sPerm = a->second->GetPermStr();
|
||||
} else {
|
||||
@@ -172,7 +172,7 @@ void CChan::AttachUser() {
|
||||
CString CChan::GetModeString() const {
|
||||
CString sModes, sArgs;
|
||||
|
||||
for (map<unsigned char, CString>::const_iterator it = m_musModes.begin(); it != m_musModes.end(); it++) {
|
||||
for (map<unsigned char, CString>::const_iterator it = m_musModes.begin(); it != m_musModes.end(); ++it) {
|
||||
sModes += it->first;
|
||||
if (it->second.size()) {
|
||||
sArgs += " " + it->second;
|
||||
@@ -185,7 +185,7 @@ CString CChan::GetModeString() const {
|
||||
CString CChan::GetModeForNames() const {
|
||||
CString sMode;
|
||||
|
||||
for (map<unsigned char, CString>::const_iterator it = m_musModes.begin(); it != m_musModes.end(); it++) {
|
||||
for (map<unsigned char, CString>::const_iterator it = m_musModes.begin(); it != m_musModes.end(); ++it) {
|
||||
if (it->first == 's') {
|
||||
sMode = "@";
|
||||
} else if ((it->first == 'p') && sMode.empty()){
|
||||
@@ -365,7 +365,7 @@ CString CChan::GetModeArg(CString& sArgs) const {
|
||||
}
|
||||
|
||||
void CChan::ClearNicks() {
|
||||
for (map<CString,CNick*>::iterator a = m_msNicks.begin(); a != m_msNicks.end(); a++) {
|
||||
for (map<CString,CNick*>::iterator a = m_msNicks.begin(); a != m_msNicks.end(); ++a) {
|
||||
delete a->second;
|
||||
}
|
||||
|
||||
@@ -379,7 +379,7 @@ int CChan::AddNicks(const CString& sNicks) {
|
||||
|
||||
sNicks.Split(" ", vsNicks, false);
|
||||
|
||||
for (it = vsNicks.begin(); it != vsNicks.end(); it++) {
|
||||
for (it = vsNicks.begin(); it != vsNicks.end(); ++it) {
|
||||
if (AddNick(*it)) {
|
||||
iRet++;
|
||||
}
|
||||
@@ -439,7 +439,7 @@ map<char, unsigned int> CChan::GetPermCounts() const {
|
||||
map<char, unsigned int> mRet;
|
||||
|
||||
map<CString,CNick*>::const_iterator it;
|
||||
for (it = m_msNicks.begin(); it != m_msNicks.end(); it++) {
|
||||
for (it = m_msNicks.begin(); it != m_msNicks.end(); ++it) {
|
||||
CString sPerms = it->second->GetPermStr();
|
||||
|
||||
for (unsigned int p = 0; p < sPerms.size(); p++) {
|
||||
|
||||
+8
-8
@@ -71,7 +71,7 @@ void CClient::UserCommand(CString& sLine) {
|
||||
Table.AddColumn("Ident");
|
||||
Table.AddColumn("Host");
|
||||
|
||||
for (map<CString,CNick*>::const_iterator a = msNicks.begin(); a != msNicks.end(); a++) {
|
||||
for (map<CString,CNick*>::const_iterator a = msNicks.begin(); a != msNicks.end(); ++a) {
|
||||
Table.AddRow();
|
||||
|
||||
for (unsigned int b = 0; b < sPerms.size(); b++) {
|
||||
@@ -168,7 +168,7 @@ void CClient::UserCommand(CString& sLine) {
|
||||
Table.AddColumn("IRC User");
|
||||
Table.AddColumn("Channels");
|
||||
|
||||
for (map<CString, CUser*>::const_iterator it = msUsers.begin(); it != msUsers.end(); it++) {
|
||||
for (map<CString, CUser*>::const_iterator it = msUsers.begin(); it != msUsers.end(); ++it) {
|
||||
Table.AddRow();
|
||||
Table.SetCell("Username", it->first);
|
||||
Table.SetCell("Clients", CString(it->second->GetClients().size()));
|
||||
@@ -611,7 +611,7 @@ void CClient::UserCommand(CString& sLine) {
|
||||
GTable.AddColumn("Description");
|
||||
set<CModInfo>::iterator it;
|
||||
|
||||
for (it = ssGlobalMods.begin(); it != ssGlobalMods.end(); it++) {
|
||||
for (it = ssGlobalMods.begin(); it != ssGlobalMods.end(); ++it) {
|
||||
const CModInfo& Info = *it;
|
||||
GTable.AddRow();
|
||||
GTable.SetCell("Name", (CZNC::Get().GetModules().FindModule(Info.GetName()) ? "*" : " ") + Info.GetName());
|
||||
@@ -634,7 +634,7 @@ void CClient::UserCommand(CString& sLine) {
|
||||
Table.AddColumn("Description");
|
||||
set<CModInfo>::iterator it;
|
||||
|
||||
for (it = ssUserMods.begin(); it != ssUserMods.end(); it++) {
|
||||
for (it = ssUserMods.begin(); it != ssUserMods.end(); ++it) {
|
||||
const CModInfo& Info = *it;
|
||||
Table.AddRow();
|
||||
Table.SetCell("Name", (m_pUser->GetModules().FindModule(Info.GetName()) ? "*" : " ") + Info.GetName());
|
||||
@@ -834,7 +834,7 @@ void CClient::UserCommand(CString& sLine) {
|
||||
Table.AddColumn("VHost");
|
||||
|
||||
VCString::const_iterator it;
|
||||
for (it = vsVHosts.begin(); it != vsVHosts.end(); it++) {
|
||||
for (it = vsVHosts.begin(); it != vsVHosts.end(); ++it) {
|
||||
Table.AddRow();
|
||||
Table.SetCell("VHost", *it);
|
||||
}
|
||||
@@ -857,7 +857,7 @@ void CClient::UserCommand(CString& sLine) {
|
||||
VCString::const_iterator it;
|
||||
bool bFound = false;
|
||||
|
||||
for (it = vsVHosts.begin(); it != vsVHosts.end(); it++) {
|
||||
for (it = vsVHosts.begin(); it != vsVHosts.end(); ++it) {
|
||||
if (sVHost.Equals(*it)) {
|
||||
bFound = true;
|
||||
break;
|
||||
@@ -927,7 +927,7 @@ void CClient::UserCommand(CString& sLine) {
|
||||
vector<CChan*>::const_iterator it;
|
||||
const vector<CChan*>& vChans = m_pUser->GetChans();
|
||||
|
||||
for (it = vChans.begin(); it != vChans.end(); it++) {
|
||||
for (it = vChans.begin(); it != vChans.end(); ++it) {
|
||||
(*it)->ClearBuffer();
|
||||
}
|
||||
PutStatus("All channel buffers have been cleared");
|
||||
@@ -968,7 +968,7 @@ void CClient::UserCommand(CString& sLine) {
|
||||
Table.AddColumn("Out");
|
||||
Table.AddColumn("Total");
|
||||
|
||||
for (it = traffic.begin(); it != traffic.end(); it++) {
|
||||
for (it = traffic.begin(); it != traffic.end(); ++it) {
|
||||
Table.AddRow();
|
||||
Table.SetCell("Username", it->first);
|
||||
Table.SetCell("In", CString::ToByteStr(it->second.first));
|
||||
|
||||
+1
-3
@@ -86,12 +86,10 @@ void CDCCBounce::ReachedMaxBuffer() {
|
||||
}
|
||||
|
||||
void CDCCBounce::ReadData(const char* data, size_t len) {
|
||||
size_t BufLen;
|
||||
|
||||
if (m_pPeer) {
|
||||
m_pPeer->Write(data, len);
|
||||
|
||||
BufLen = m_pPeer->GetInternalWriteBuffer().length();
|
||||
size_t BufLen = m_pPeer->GetInternalWriteBuffer().length();
|
||||
|
||||
if (BufLen >= m_uiMaxDCCBuffer) {
|
||||
DEBUG(GetSockName() << " The send buffer is over the "
|
||||
|
||||
+1
-1
@@ -490,7 +490,7 @@ bool CDir::MakeDir(const CString& sPath, mode_t iMode) {
|
||||
|
||||
// For every single subpath, do...
|
||||
sPath.Split("/", dirs, false);
|
||||
for (it = dirs.begin(); it != dirs.end(); it++) {
|
||||
for (it = dirs.begin(); it != dirs.end(); ++it) {
|
||||
// Add this to the path we already created
|
||||
sDir += *it;
|
||||
|
||||
|
||||
+1
-1
@@ -407,7 +407,7 @@ bool CHTTPSock::PrintHeader(off_t uContentLength, const CString& sContentType, u
|
||||
}
|
||||
Write("Content-Type: " + m_sContentType + "\r\n");
|
||||
|
||||
for (MCString::iterator it = m_msHeaders.begin(); it != m_msHeaders.end(); it++) {
|
||||
for (MCString::iterator it = m_msHeaders.begin(); it != m_msHeaders.end(); ++it) {
|
||||
Write(it->first + ": " + it->second + "\r\n");
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -49,7 +49,7 @@ CIRCSock::~CIRCSock() {
|
||||
|
||||
m_pUser->IRCDisconnected();
|
||||
|
||||
for (map<CString, CChan*>::iterator a = m_msChans.begin(); a != m_msChans.end(); a++) {
|
||||
for (map<CString, CChan*>::iterator a = m_msChans.begin(); a != m_msChans.end(); ++a) {
|
||||
delete a->second;
|
||||
}
|
||||
|
||||
@@ -861,7 +861,7 @@ void CIRCSock::Disconnected() {
|
||||
// otherwise, on reconnect, it might think it still
|
||||
// had user modes that it actually doesn't have.
|
||||
CString sUserMode;
|
||||
for (set<unsigned char>::const_iterator it = m_scUserModes.begin(); it != m_scUserModes.end(); it++) {
|
||||
for (set<unsigned char>::const_iterator it = m_scUserModes.begin(); it != m_scUserModes.end(); ++it) {
|
||||
sUserMode += *it;
|
||||
}
|
||||
if (!sUserMode.empty()) {
|
||||
@@ -1101,7 +1101,7 @@ CIRCSock::EChanModeArgs CIRCSock::GetModeType(unsigned char uMode) const {
|
||||
}
|
||||
|
||||
void CIRCSock::ResetChans() {
|
||||
for (map<CString, CChan*>::iterator a = m_msChans.begin(); a != m_msChans.end(); a++) {
|
||||
for (map<CString, CChan*>::iterator a = m_msChans.begin(); a != m_msChans.end(); ++a) {
|
||||
a->second->Reset();
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -744,7 +744,7 @@ bool CModules::UnloadModule(const CString& sModule, CString& sRetMsg) {
|
||||
}
|
||||
|
||||
if (pModule->IsFake()) {
|
||||
for (iterator it = begin(); it != end(); it++) {
|
||||
for (iterator it = begin(); it != end(); ++it) {
|
||||
if (*it == pModule) {
|
||||
erase(it);
|
||||
sRetMsg = "Fake module [" + sMod + "] unloaded";
|
||||
@@ -765,7 +765,7 @@ bool CModules::UnloadModule(const CString& sModule, CString& sRetMsg) {
|
||||
if (Unload) {
|
||||
Unload(pModule);
|
||||
|
||||
for (iterator it = begin(); it != end(); it++) {
|
||||
for (iterator it = begin(); it != end(); ++it) {
|
||||
if (*it == pModule) {
|
||||
erase(it);
|
||||
break;
|
||||
|
||||
@@ -57,7 +57,7 @@ unsigned int CNick::GetCommonChans(vector<CChan*>& vRetChans, CUser* pUser) cons
|
||||
CChan* pChan = vChans[a];
|
||||
const map<CString,CNick*>& msNicks = pChan->GetNicks();
|
||||
|
||||
for (map<CString,CNick*>::const_iterator it = msNicks.begin(); it != msNicks.end(); it++) {
|
||||
for (map<CString,CNick*>::const_iterator it = msNicks.begin(); it != msNicks.end(); ++it) {
|
||||
if (it->first.Equals(m_sNick)) {
|
||||
vRetChans.push_back(pChan);
|
||||
continue;
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ unsigned int CSockManager::GetAnonConnectionCount(const CString &sIP) const {
|
||||
const_iterator it;
|
||||
unsigned int ret = 0;
|
||||
|
||||
for (it = begin(); it != end(); it++) {
|
||||
for (it = begin(); it != end(); ++it) {
|
||||
CZNCSock *pSock = *it;
|
||||
// Logged in CClients have "USR::<username>" as their sockname
|
||||
if (pSock->GetRemoteIP() == sIP && pSock->GetSockName().Left(5) != "USR::") {
|
||||
|
||||
+4
-4
@@ -69,7 +69,7 @@ CString CTemplateLoopContext::GetValue(const CString& sName, bool bFromIf) {
|
||||
}
|
||||
|
||||
CTemplate::~CTemplate() {
|
||||
for (map<CString, vector<CTemplate*> >::iterator it = m_mvLoops.begin(); it != m_mvLoops.end(); it++) {
|
||||
for (map<CString, vector<CTemplate*> >::iterator it = m_mvLoops.begin(); it != m_mvLoops.end(); ++it) {
|
||||
vector<CTemplate*>& vLoop = it->second;
|
||||
for (unsigned int a = 0; a < vLoop.size(); a++) {
|
||||
delete vLoop[a];
|
||||
@@ -101,7 +101,7 @@ CString CTemplate::ExpandFile(const CString& sFilename) {
|
||||
|
||||
CString sFile(ResolveLiteral(sFilename));
|
||||
|
||||
for (LCString::iterator it = m_lsPaths.begin(); it != m_lsPaths.end(); it++) {
|
||||
for (LCString::iterator it = m_lsPaths.begin(); it != m_lsPaths.end(); ++it) {
|
||||
CString sRoot = *it;
|
||||
CString sFilePath(CDir::ChangeDir(sRoot, sFile));
|
||||
|
||||
@@ -323,7 +323,7 @@ bool CTemplate::Print(const CString& sFileName, ostream& oOut) {
|
||||
if (sArgs.Token(1, true, " ").OptionSplit(msRow)) {
|
||||
CTemplate& NewRow = AddRow(sLoopName);
|
||||
|
||||
for (MCString::iterator it = msRow.begin(); it != msRow.end(); it++) {
|
||||
for (MCString::iterator it = msRow.begin(); it != msRow.end(); ++it) {
|
||||
NewRow[it->first] = it->second;
|
||||
}
|
||||
}
|
||||
@@ -767,11 +767,11 @@ CString CTemplate::GetValue(const CString& sArgs, bool bFromIf) {
|
||||
|
||||
if (!vspTagHandlers.empty()) { // @todo this should go up to the top to grab handlers
|
||||
CTemplate* pTmpl = GetCurTemplate();
|
||||
CString sCustomOutput;
|
||||
|
||||
if (sRet.empty()) {
|
||||
for (unsigned int j = 0; j < vspTagHandlers.size(); j++) {
|
||||
CSmartPtr<CTemplateTagHandler> spTagHandler = vspTagHandlers[j];
|
||||
CString sCustomOutput;
|
||||
|
||||
if (!bFromIf && spTagHandler->HandleVar(*pTmpl, sArgs.Token(0), sArgs.Token(1, true), sCustomOutput)) {
|
||||
sRet = sCustomOutput;
|
||||
|
||||
@@ -125,7 +125,7 @@ bool CUser::UpdateModule(const CString &sModule) {
|
||||
map<CUser*, CString>::iterator it2;
|
||||
bool error = false;
|
||||
|
||||
for (it = Users.begin(); it != Users.end(); it++) {
|
||||
for (it = Users.begin(); it != Users.end(); ++it) {
|
||||
CModule *pMod = it->second->GetModules().FindModule(sModule);
|
||||
if (pMod) {
|
||||
Affected[it->second] = pMod->GetArgs();
|
||||
@@ -134,7 +134,7 @@ bool CUser::UpdateModule(const CString &sModule) {
|
||||
}
|
||||
|
||||
CString sErr;
|
||||
for (it2 = Affected.begin(); it2 != Affected.end(); it2++) {
|
||||
for (it2 = Affected.begin(); it2 != Affected.end(); ++it2) {
|
||||
if (!it2->first->GetModules().LoadModule(sModule, it2->second, it2->first, sErr)) {
|
||||
error = true;
|
||||
DEBUG("Failed to reload [" << sModule << "] for [" << it2->first->GetUserName()
|
||||
@@ -287,7 +287,7 @@ void CUser::UserConnected(CClient* pClient) {
|
||||
CString sUserMode("");
|
||||
const set<unsigned char>& scUserModes = GetIRCSock()->GetUserModes();
|
||||
for (set<unsigned char>::const_iterator it = scUserModes.begin();
|
||||
it != scUserModes.end(); it++) {
|
||||
it != scUserModes.end(); ++it) {
|
||||
sUserMode += *it;
|
||||
}
|
||||
if (!sUserMode.empty()) {
|
||||
@@ -366,7 +366,7 @@ bool CUser::Clone(const CUser& User, CString& sErrorRet, bool bCloneChans) {
|
||||
// Allowed Hosts
|
||||
m_ssAllowedHosts.clear();
|
||||
const set<CString>& ssHosts = User.GetAllowedHosts();
|
||||
for (set<CString>::const_iterator it = ssHosts.begin(); it != ssHosts.end(); it++) {
|
||||
for (set<CString>::const_iterator it = ssHosts.begin(); it != ssHosts.end(); ++it) {
|
||||
AddAllowedHost(*it);
|
||||
}
|
||||
|
||||
@@ -444,7 +444,7 @@ bool CUser::Clone(const CUser& User, CString& sErrorRet, bool bCloneChans) {
|
||||
// CTCP Replies
|
||||
m_mssCTCPReplies.clear();
|
||||
const MCString& msReplies = User.GetCTCPReplies();
|
||||
for (MCString::const_iterator it = msReplies.begin(); it != msReplies.end(); it++) {
|
||||
for (MCString::const_iterator it = msReplies.begin(); it != msReplies.end(); ++it) {
|
||||
AddCTCPReply(it->first, it->second);
|
||||
}
|
||||
// !CTCP Replies
|
||||
@@ -490,7 +490,7 @@ bool CUser::Clone(const CUser& User, CString& sErrorRet, bool bCloneChans) {
|
||||
}
|
||||
}
|
||||
|
||||
for (set<CString>::iterator it = ssUnloadMods.begin(); it != ssUnloadMods.end(); it++) {
|
||||
for (set<CString>::iterator it = ssUnloadMods.begin(); it != ssUnloadMods.end(); ++it) {
|
||||
vCurMods.UnloadModule(*it);
|
||||
}
|
||||
// !Modules
|
||||
@@ -514,7 +514,7 @@ bool CUser::IsHostAllowed(const CString& sHostMask) const {
|
||||
return true;
|
||||
}
|
||||
|
||||
for (set<CString>::const_iterator a = m_ssAllowedHosts.begin(); a != m_ssAllowedHosts.end(); a++) {
|
||||
for (set<CString>::const_iterator a = m_ssAllowedHosts.begin(); a != m_ssAllowedHosts.end(); ++a) {
|
||||
if (sHostMask.WildCmp(*a)) {
|
||||
return true;
|
||||
}
|
||||
@@ -597,7 +597,7 @@ bool CUser::AddChan(const CString& sName, bool bInConfig) {
|
||||
}
|
||||
|
||||
bool CUser::DelChan(const CString& sName) {
|
||||
for (vector<CChan*>::iterator a = m_vChans.begin(); a != m_vChans.end(); a++) {
|
||||
for (vector<CChan*>::iterator a = m_vChans.begin(); a != m_vChans.end(); ++a) {
|
||||
if (sName.Equals((*a)->GetName())) {
|
||||
delete *a;
|
||||
m_vChans.erase(a);
|
||||
@@ -664,7 +664,7 @@ bool CUser::WriteConfig(CFile& File) {
|
||||
|
||||
// Allow Hosts
|
||||
if (!m_ssAllowedHosts.empty()) {
|
||||
for (set<CString>::iterator it = m_ssAllowedHosts.begin(); it != m_ssAllowedHosts.end(); it++) {
|
||||
for (set<CString>::iterator it = m_ssAllowedHosts.begin(); it != m_ssAllowedHosts.end(); ++it) {
|
||||
PrintLine(File, "Allow", *it);
|
||||
}
|
||||
|
||||
@@ -673,7 +673,7 @@ bool CUser::WriteConfig(CFile& File) {
|
||||
|
||||
// CTCP Replies
|
||||
if (!m_mssCTCPReplies.empty()) {
|
||||
for (MCString::iterator itb = m_mssCTCPReplies.begin(); itb != m_mssCTCPReplies.end(); itb++) {
|
||||
for (MCString::iterator itb = m_mssCTCPReplies.begin(); itb != m_mssCTCPReplies.end(); ++itb) {
|
||||
PrintLine(File, "CTCPReply", itb->first.AsUpper() + " " + itb->second);
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ void CUtils::GenerateCert(FILE *pOut, const CString& sHost) {
|
||||
EVP_PKEY *pKey = NULL;
|
||||
X509 *pCert = NULL;
|
||||
X509_NAME *pName = NULL;
|
||||
int days = 365;
|
||||
const int days = 365;
|
||||
|
||||
u_int iSeed = time(NULL);
|
||||
int serial = (rand_r(&iSeed) % 9999);
|
||||
|
||||
+2
-2
@@ -1018,7 +1018,7 @@ int MCString::WriteToDisk(const CString& sPath, mode_t iMode) {
|
||||
return MCS_EOPEN;
|
||||
}
|
||||
|
||||
for (MCString::iterator it = this->begin(); it != this->end(); it++) {
|
||||
for (MCString::iterator it = this->begin(); it != this->end(); ++it) {
|
||||
CString sKey = it->first;
|
||||
CString sValue = it->second;
|
||||
if (!WriteFilter(sKey, sValue)) {
|
||||
@@ -1070,7 +1070,7 @@ static const char hexdigits[] = "0123456789abcdef";
|
||||
|
||||
CString& MCString::Encode(CString& sValue) {
|
||||
CString sTmp;
|
||||
for (CString::iterator it = sValue.begin(); it != sValue.end(); it++) {
|
||||
for (CString::iterator it = sValue.begin(); it != sValue.end(); ++it) {
|
||||
if (isalnum(*it)) {
|
||||
sTmp += *it;
|
||||
} else {
|
||||
|
||||
+1
-1
@@ -433,7 +433,7 @@ class CAdminMod : public CModule {
|
||||
Table.AddColumn("Ident");
|
||||
Table.AddColumn("VHost");
|
||||
|
||||
for (map<CString, CUser*>::const_iterator it = msUsers.begin(); it != msUsers.end(); it++) {
|
||||
for (map<CString, CUser*>::const_iterator it = msUsers.begin(); it != msUsers.end(); ++it) {
|
||||
Table.AddRow();
|
||||
Table.SetCell("Username", it->first);
|
||||
Table.SetCell("Realname", it->second->GetRealName());
|
||||
|
||||
@@ -30,7 +30,7 @@ public:
|
||||
|
||||
// Load our saved settings, ignore errors
|
||||
MCString::iterator it;
|
||||
for (it = BeginNV(); it != EndNV(); it++) {
|
||||
for (it = BeginNV(); it != EndNV(); ++it) {
|
||||
Add(it->first);
|
||||
}
|
||||
|
||||
@@ -125,12 +125,12 @@ public:
|
||||
if (sInput.Left(1) == "!") {
|
||||
CString sChan = sInput.substr(1);
|
||||
for (it = m_vsNegChans.begin(); it != m_vsNegChans.end();
|
||||
it++) {
|
||||
++it) {
|
||||
if (*it == sChan)
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
for (it = m_vsChans.begin(); it != m_vsChans.end(); it++) {
|
||||
for (it = m_vsChans.begin(); it != m_vsChans.end(); ++it) {
|
||||
if (*it == sInput)
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ public:
|
||||
|
||||
// Load our saved settings, ignore errors
|
||||
MCString::iterator it;
|
||||
for (it = BeginNV(); it != EndNV(); it++) {
|
||||
for (it = BeginNV(); it != EndNV(); ++it) {
|
||||
Add(it->first);
|
||||
}
|
||||
|
||||
@@ -137,12 +137,12 @@ protected:
|
||||
if (sInput.Left(1) == "!") {
|
||||
CString sChan = sInput.substr(1);
|
||||
for (it = m_vsNegChans.begin(); it != m_vsNegChans.end();
|
||||
it++) {
|
||||
++it) {
|
||||
if (*it == sChan)
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
for (it = m_vsChans.begin(); it != m_vsChans.end(); it++) {
|
||||
for (it = m_vsChans.begin(); it != m_vsChans.end(); ++it) {
|
||||
if (*it == sInput)
|
||||
return true;
|
||||
}
|
||||
|
||||
+12
-12
@@ -52,7 +52,7 @@ public:
|
||||
const CString& GetHostmask() const { return m_sHostmask; }
|
||||
|
||||
bool ChannelMatches(const CString& sChan) const {
|
||||
for (set<CString>::const_iterator it = m_ssChans.begin(); it != m_ssChans.end(); it++) {
|
||||
for (set<CString>::const_iterator it = m_ssChans.begin(); it != m_ssChans.end(); ++it) {
|
||||
if (sChan.AsLower().WildCmp(*it)) {
|
||||
return true;
|
||||
}
|
||||
@@ -68,7 +68,7 @@ public:
|
||||
CString GetChannels() const {
|
||||
CString sRet;
|
||||
|
||||
for (set<CString>::const_iterator it = m_ssChans.begin(); it != m_ssChans.end(); it++) {
|
||||
for (set<CString>::const_iterator it = m_ssChans.begin(); it != m_ssChans.end(); ++it) {
|
||||
if (!sRet.empty()) {
|
||||
sRet += " ";
|
||||
}
|
||||
@@ -100,7 +100,7 @@ public:
|
||||
CString ToString() const {
|
||||
CString sChans;
|
||||
|
||||
for (set<CString>::const_iterator it = m_ssChans.begin(); it != m_ssChans.end(); it++) {
|
||||
for (set<CString>::const_iterator it = m_ssChans.begin(); it != m_ssChans.end(); ++it) {
|
||||
if (!sChans.empty()) {
|
||||
sChans += " ";
|
||||
}
|
||||
@@ -135,7 +135,7 @@ public:
|
||||
AddTimer(new CAutoOpTimer(this));
|
||||
|
||||
// Load the users
|
||||
for (MCString::iterator it = BeginNV(); it != EndNV(); it++) {
|
||||
for (MCString::iterator it = BeginNV(); it != EndNV(); ++it) {
|
||||
const CString& sLine = it->second;
|
||||
CAutoOpUser* pUser = new CAutoOpUser;
|
||||
|
||||
@@ -150,7 +150,7 @@ public:
|
||||
}
|
||||
|
||||
virtual ~CAutoOpMod() {
|
||||
for (map<CString, CAutoOpUser*>::iterator it = m_msUsers.begin(); it != m_msUsers.end(); it++) {
|
||||
for (map<CString, CAutoOpUser*>::iterator it = m_msUsers.begin(); it != m_msUsers.end(); ++it) {
|
||||
delete it->second;
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ public:
|
||||
virtual void OnJoin(const CNick& Nick, CChan& Channel) {
|
||||
// If we have ops in this chan
|
||||
if (Channel.HasPerm(CChan::Op)) {
|
||||
for (map<CString, CAutoOpUser*>::iterator it = m_msUsers.begin(); it != m_msUsers.end(); it++) {
|
||||
for (map<CString, CAutoOpUser*>::iterator it = m_msUsers.begin(); it != m_msUsers.end(); ++it) {
|
||||
// and the nick who joined is a valid user
|
||||
if (it->second->HostMatches(Nick.GetHostMask()) && it->second->ChannelMatches(Channel.GetName())) {
|
||||
if (it->second->GetUserKey().Equals("__NOKEY__")) {
|
||||
@@ -249,7 +249,7 @@ public:
|
||||
Table.AddColumn("Key");
|
||||
Table.AddColumn("Channels");
|
||||
|
||||
for (map<CString, CAutoOpUser*>::iterator it = m_msUsers.begin(); it != m_msUsers.end(); it++) {
|
||||
for (map<CString, CAutoOpUser*>::iterator it = m_msUsers.begin(); it != m_msUsers.end(); ++it) {
|
||||
Table.AddRow();
|
||||
Table.SetCell("User", it->second->GetUsername());
|
||||
Table.SetCell("Hostmask", it->second->GetHostmask());
|
||||
@@ -295,7 +295,7 @@ public:
|
||||
}
|
||||
|
||||
CAutoOpUser* FindUserByHost(const CString& sHostmask, const CString& sChannel = "") {
|
||||
for (map<CString, CAutoOpUser*>::iterator it = m_msUsers.begin(); it != m_msUsers.end(); it++) {
|
||||
for (map<CString, CAutoOpUser*>::iterator it = m_msUsers.begin(); it != m_msUsers.end(); ++it) {
|
||||
CAutoOpUser* pUser = it->second;
|
||||
|
||||
if (pUser->HostMatches(sHostmask) && (sChannel.empty() || pUser->ChannelMatches(sChannel))) {
|
||||
@@ -337,7 +337,7 @@ public:
|
||||
bool bMatchedHost = false;
|
||||
CAutoOpUser* pUser = NULL;
|
||||
|
||||
for (map<CString, CAutoOpUser*>::iterator it = m_msUsers.begin(); it != m_msUsers.end(); it++) {
|
||||
for (map<CString, CAutoOpUser*>::iterator it = m_msUsers.begin(); it != m_msUsers.end(); ++it) {
|
||||
pUser = it->second;
|
||||
|
||||
// First verify that the guy who challenged us matches a user's host
|
||||
@@ -396,7 +396,7 @@ public:
|
||||
CString sChallenge = itQueue->second;
|
||||
m_msQueue.erase(itQueue);
|
||||
|
||||
for (map<CString, CAutoOpUser*>::iterator it = m_msUsers.begin(); it != m_msUsers.end(); it++) {
|
||||
for (map<CString, CAutoOpUser*>::iterator it = m_msUsers.begin(); it != m_msUsers.end(); ++it) {
|
||||
if (it->second->HostMatches(Nick.GetHostMask())) {
|
||||
if (sResponse == CString(it->second->GetUserKey() + "::" + sChallenge).MD5()) {
|
||||
OpUser(Nick, *it->second);
|
||||
@@ -420,7 +420,7 @@ public:
|
||||
while (bRemoved) {
|
||||
bRemoved = false;
|
||||
|
||||
for (MCString::iterator it = m_msQueue.begin(); it != m_msQueue.end(); it++) {
|
||||
for (MCString::iterator it = m_msQueue.begin(); it != m_msQueue.end(); ++it) {
|
||||
if (!it->second.empty()) {
|
||||
m_msQueue.erase(it);
|
||||
bRemoved = true;
|
||||
@@ -430,7 +430,7 @@ public:
|
||||
}
|
||||
|
||||
// Now issue challenges for the new users in the queue
|
||||
for (MCString::iterator it = m_msQueue.begin(); it != m_msQueue.end(); it++) {
|
||||
for (MCString::iterator it = m_msQueue.begin(); it != m_msQueue.end(); ++it) {
|
||||
it->second = CString::RandomString(AUTOOP_CHALLENGE_LENGTH);
|
||||
PutIRC("NOTICE " + it->first + " :!ZNCAO CHALLENGE " + it->second);
|
||||
}
|
||||
|
||||
+2
-2
@@ -96,7 +96,7 @@ public:
|
||||
|
||||
sFile.Split("\n", vsLines);
|
||||
|
||||
for (it = vsLines.begin(); it != vsLines.end(); it++) {
|
||||
for (it = vsLines.begin(); it != vsLines.end(); ++it) {
|
||||
CString sLine(*it);
|
||||
sLine.Trim();
|
||||
AddMessage(sLine);
|
||||
@@ -248,7 +248,7 @@ 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++)
|
||||
|
||||
@@ -38,7 +38,7 @@ public:
|
||||
virtual void OnQuit(const CNick& Nick, const CString& sMessage, const vector<CChan*>& vChans) {
|
||||
vector<CChan*>::const_iterator it;
|
||||
CString sMsg = Nick.GetNickMask() + " quit with message: [" + sMessage + "]";
|
||||
for (it = vChans.begin(); it != vChans.end(); it++) {
|
||||
for (it = vChans.begin(); it != vChans.end(); ++it) {
|
||||
AddBuffer(**it, sMsg);
|
||||
}
|
||||
}
|
||||
@@ -54,7 +54,7 @@ public:
|
||||
virtual void OnNick(const CNick& OldNick, const CString& sNewNick, const vector<CChan*>& vChans) {
|
||||
vector<CChan*>::const_iterator it;
|
||||
CString sMsg = OldNick.GetNickMask() + " is now known as " + sNewNick;
|
||||
for (it = vChans.begin(); it != vChans.end(); it++) {
|
||||
for (it = vChans.begin(); it != vChans.end(); ++it) {
|
||||
AddBuffer(**it, sMsg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ public:
|
||||
|
||||
m_bWriteConf = false;
|
||||
|
||||
for (; it != end; it++) {
|
||||
for (; it != end; ++it) {
|
||||
CChan *pChan = *it;
|
||||
|
||||
// If that channel isn't yet in the config,
|
||||
|
||||
+1
-1
@@ -124,7 +124,7 @@ public:
|
||||
Table.AddColumn("Target");
|
||||
Table.AddColumn("Key");
|
||||
|
||||
for (MCString::iterator it = BeginNV(); it != EndNV(); it++) {
|
||||
for (MCString::iterator it = BeginNV(); it != EndNV(); ++it) {
|
||||
Table.AddRow();
|
||||
Table.SetCell("Target", it->first);
|
||||
Table.SetCell("Key", it->second);
|
||||
|
||||
Reference in New Issue
Block a user