mirror of
https://github.com/znc/znc.git
synced 2026-08-11 03:12:50 +02:00
Use CString::Split() in more places
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1808 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
+7
-5
@@ -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")) {
|
||||
|
||||
+6
-4
@@ -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(" ");
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+7
-10
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user