diff --git a/Client.cpp b/Client.cpp index 35c4c11c..1c5badc1 100644 --- a/Client.cpp +++ b/Client.cpp @@ -309,14 +309,16 @@ void CClient::ReadLine(const CString& sData) { Close(Csock::CLT_AFTERWRITE); // Treat a client quit as a detach return; // Don't forward this msg. We don't want the client getting us disconnected. } else if (sCommand.Equals("PROTOCTL")) { - unsigned int i = 1; - while (!sLine.Token(i).empty()) { - if (sLine.Token(i).Equals("NAMESX")) { + VCString vsTokens; + VCString::const_iterator it; + sLine.Token(1, true).Split(" ", vsTokens, false); + + for (it = vsTokens.begin(); it != vsTokens.end(); ++it) { + if (*it == "NAMESX") { m_bNamesx = true; - } else if (sLine.Token(i).Equals("UHNAMES")) { + } else if (*it == "UHNAMES") { m_bUHNames = true; } - i++; } return; // If the server understands it, we already enabled namesx / uhnames } else if (sCommand.Equals("NOTICE")) { diff --git a/IRCSock.cpp b/IRCSock.cpp index 5d55d3a3..34ca5b67 100644 --- a/IRCSock.cpp +++ b/IRCSock.cpp @@ -1000,10 +1000,13 @@ void CIRCSock::ForwardRaw353(const CString& sLine) const { // Get everything except the actual user list CString sTmp = sLine.Token(0, false, " :") + " :"; - unsigned int i = 0; + VCString vsNicks; + VCString::const_iterator it; + // This loop runs once for every nick on the channel - for (;;) { - CString sNick = sNicks.Token(i).Trim_n(" "); + sNicks.Split(" ", vsNicks, false); + for (it = vsNicks.begin(); it != vsNicks.end(); ++it) { + CString sNick = *it; if (sNick.empty()) break; @@ -1022,7 +1025,6 @@ void CIRCSock::ForwardRaw353(const CString& sLine) const { } sTmp += sNick + " "; - i++; } // Strip away the spaces we inserted at the end sTmp.TrimRight(" "); diff --git a/modules/autoattach.cpp b/modules/autoattach.cpp index 2e69edd8..5ec5c806 100644 --- a/modules/autoattach.cpp +++ b/modules/autoattach.cpp @@ -17,15 +17,13 @@ public: } virtual bool OnLoad(const CString& sArgs, CString& sMessage) { - unsigned int a = 0; - CString sChan = sArgs.Token(a++); + VCString vsChans; + sArgs.Split(" ", vsChans, false); - while (!sChan.empty()) { - if (!Add(sChan)) { - PutModule("Unable to add [" + sChan + "]"); + for (VCString::const_iterator it = vsChans.begin(); it != vsChans.end(); ++it) { + if (!Add(*it)) { + PutModule("Unable to add [" + *it + "]"); } - - sChan = sArgs.Token(a++); } // Load our saved settings, ignore errors diff --git a/modules/autocycle.cpp b/modules/autocycle.cpp index fc086b5e..35ff7e98 100644 --- a/modules/autocycle.cpp +++ b/modules/autocycle.cpp @@ -15,15 +15,13 @@ public: virtual ~CAutoCycleMod() {} virtual bool OnLoad(const CString& sArgs, CString& sMessage) { - unsigned int a = 0; - CString sChan = sArgs.Token(a++); + VCString vsChans; + sArgs.Split(" ", vsChans, false); - while (!sChan.empty()) { - if (!Add(sChan)) { - PutModule("Unable to add [" + sChan + "]"); + for (VCString::const_iterator it = vsChans.begin(); it != vsChans.end(); ++it) { + if (!Add(*it)) { + PutModule("Unable to add [" + *it + "]"); } - - sChan = sArgs.Token(a++); } // Load our saved settings, ignore errors diff --git a/modules/extra/autovoice.cpp b/modules/extra/autovoice.cpp index 7bb1b6c3..831a2d63 100644 --- a/modules/extra/autovoice.cpp +++ b/modules/extra/autovoice.cpp @@ -109,14 +109,13 @@ public: virtual bool OnLoad(const CString& sArgs, CString& sMessage) { // Load the chans from the command line unsigned int a = 0; - CString sChan = sArgs.Token(a++); + VCString vsChans; + sArgs.Split(" ", vsChans, false); - while (!sChan.empty()) { + for (VCString::const_iterator it = vsChans.begin(); it != vsChans.end(); ++it) { CString sName = "Args"; sName += CString(a); - AddUser(sName, "*", sChan); - - sChan = sArgs.Token(a++); + AddUser(sName, "*", *it); } // Load the saved users diff --git a/modules/extra/saslauth.cpp b/modules/extra/saslauth.cpp index 9377ad3d..1c39e874 100644 --- a/modules/extra/saslauth.cpp +++ b/modules/extra/saslauth.cpp @@ -27,17 +27,17 @@ public: } virtual bool OnLoad(const CString& sArgs, CString& sMessage) { - int i(0); - CString arg(sArgs.Token(i)); + VCString vsChans; + VCString::const_iterator it; + sArgs.Split(" ", vsChans, false); - while (!arg.empty()) { - if (arg.StrCmp("saslauthd") || arg.StrCmp("auxprop")) { - method += arg + " "; + for (it = vsChans.begin(); it != vsChans.end(); ++it) { + if (it->StrCmp("saslauthd") || it->StrCmp("auxprop")) { + method += *it + " "; } else { - CUtils::PrintError("Ignoring invalid SASL pwcheck method: " + arg); + CUtils::PrintError("Ignoring invalid SASL pwcheck method: " + *it); } - arg = sArgs.Token(++i); } method.TrimRight(); diff --git a/modules/partyline.cpp b/modules/partyline.cpp index efeb25ef..d1f67672 100644 --- a/modules/partyline.cpp +++ b/modules/partyline.cpp @@ -71,12 +71,13 @@ public: } } - CString sChan; - unsigned int a = 0; - while (!(sChan = sArgs.Token(a++)).empty()) { - if (sChan.Left(2) == CHAN_PREFIX) { - sChan = sChan.Left(32); - m_ssDefaultChans.insert(sChan); + VCString vsChans; + VCString::const_iterator it; + sArgs.Split(" ", vsChans, false); + + for (it = vsChans.begin(); it != vsChans.end(); ++it) { + if (it->Left(2) == CHAN_PREFIX) { + m_ssDefaultChans.insert(it->Left(32)); } } diff --git a/modules/watch.cpp b/modules/watch.cpp index 9c7bf872..9629499c 100644 --- a/modules/watch.cpp +++ b/modules/watch.cpp @@ -130,21 +130,18 @@ public: void SetPattern(const CString& s) { m_sPattern = s; } void SetDisabled(bool b = true) { m_bDisabled = b; } void SetSources(const CString& sSources) { - unsigned int uIdx = 1; - CString sSrc = sSources.Token(0); + VCString vsSources; + VCString::iterator it; + sSources.Split(" ", vsSources, false); m_vsSources.clear(); - while (sSrc.size()) { - if (sSrc[0] == '!') { - if (sSrc.size() > 1) { - m_vsSources.push_back(CWatchSource(sSrc.substr(1), true)); - } + for (it = vsSources.begin(); it != vsSources.end(); ++it) { + if (it->at(0) == '!' && it->size() > 1) { + m_vsSources.push_back(CWatchSource(it->substr(1), true)); } else { - m_vsSources.push_back(CWatchSource(sSrc, false)); + m_vsSources.push_back(CWatchSource(*it, false)); } - - sSrc = sSources.Token(uIdx++); } } // !Setters