Optimize our ISUPPORT token parsing

CString::Split() is nice and beautiful and way better than what we did before.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1807 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
psychon
2010-03-06 15:34:48 +00:00
parent 3526b740b3
commit 6796cabbaf
+11 -7
View File
@@ -934,12 +934,14 @@ void CIRCSock::ReachedMaxBuffer() {
}
void CIRCSock::ParseISupport(const CString& sLine) {
unsigned int i = 0;
CString sArg = sLine.Token(i++);
VCString vsTokens;
VCString::iterator it;
while (!sArg.empty()) {
CString sName = sArg.Token(0, false, "=");
CString sValue = sArg.Token(1, true, "=");
sLine.Split(" ", vsTokens, false);
for (it = vsTokens.begin(); it != vsTokens.end(); ++it) {
CString sName = it->Token(0, false, "=");
CString sValue = it->Token(1, true, "=");
if (sName.Equals("PREFIX")) {
CString sPrefixes = sValue.Token(1, false, ")");
@@ -971,14 +973,16 @@ void CIRCSock::ParseISupport(const CString& sLine) {
}
}
} else if (sName.Equals("NAMESX")) {
if (m_bNamesx)
continue;
m_bNamesx = true;
PutIRC("PROTOCTL NAMESX");
} else if (sName.Equals("UHNAMES")) {
if (m_bUHNames)
continue;
m_bUHNames = true;
PutIRC("PROTOCTL UHNAMES");
}
sArg = sLine.Token(i++);
}
}