diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2005-12-02 16:02:47 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2005-12-02 16:02:47 +0000 |
commit | d4e3eb56e271a40043c86abce55b0391e03b0ca2 (patch) | |
tree | f618918e41dd14be9cdb55c3044e5ccda0eea10c | |
parent | 4fb13263bfd2325184caf98f48163a9e63f755fa (diff) |
Fixed splitter algorithm to not trim off spaces in a 'final' parameter
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2117 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | src/modules/m_spanningtree.cpp | 52 |
1 files changed, 36 insertions, 16 deletions
diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp index 31621d980..710a57d97 100644 --- a/src/modules/m_spanningtree.cpp +++ b/src/modules/m_spanningtree.cpp @@ -896,34 +896,53 @@ class TreeSocket : public InspSocket std::deque<std::string> Split(std::string line, bool stripcolon) { std::deque<std::string> n; + if (!strchr(line.c_str(),' ')) + { + n.push_back(line); + return n; + } std::stringstream s(line); std::string param = ""; n.clear(); int item = 0; while (!s.eof()) { - s >> param; - //if ((param != "") && (param != "\n")) - //{ - if ((param.c_str()[0] == ':') && (item)) + char c; + s.get(c); + if (c == ' ') + { + log(DEBUG,"Push back %s",param.c_str()); + n.push_back(param); + param = ""; + item++; + } + else + { + if (!s.eof()) { - char* str = (char*)param.c_str(); - str++; - param = str; - std::string append; + param = param + c; + } + if ((param == ":") && (item > 0)) + { + param = ""; while (!s.eof()) { - append = ""; - s >> append; - if (append != "") + s.get(c); + if (!s.eof()) { - param = param + " " + append; + param = param + c; } } + log(DEBUG,"Push back %s",param.c_str()); + n.push_back(param); + param = ""; } - item++; - n.push_back(param); - //} + } + } + if (param != "") + { + log(DEBUG,"Push back %s",param.c_str()); + n.push_back(param); } return n; } @@ -938,6 +957,7 @@ class TreeSocket : public InspSocket return true; Srv->Log(DEBUG,"inbound-line: '"+line+"'"); std::deque<std::string> params = this->Split(line,true); + log(DEBUG,"*** Number of params = %d",params.size()); std::string command = ""; std::string prefix = ""; if (((params[0].c_str())[0] == ':') && (params.size() > 1)) @@ -1111,7 +1131,7 @@ class TreeSocket : public InspSocket } return true; - break; + break; } return true; } |