From 99795271eb95232d826a55988748ca16081ba677 Mon Sep 17 00:00:00 2001 From: brain Date: Wed, 26 Jul 2006 20:31:27 +0000 Subject: [PATCH] Adapt m_spanningtree to use irc::tokenstream instead of its own irc-line-parser (that was teh sux) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4547 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_spanningtree.cpp | 69 +++------------------------------- 1 file changed, 5 insertions(+), 64 deletions(-) diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp index d8ac2d074..9f02af689 100644 --- a/src/modules/m_spanningtree.cpp +++ b/src/modules/m_spanningtree.cpp @@ -2176,72 +2176,13 @@ class TreeSocket : public InspSocket return false; } - void Split(std::string line, bool stripcolon, std::deque &n) + void Split(std::string line, std::deque &n) { - // we don't do anything with a line > 2048 - if (line.length() > 2048) - { - log(DEBUG,"Line too long!"); - return; - } - if (!strchr(line.c_str(),' ')) - { - n.push_back(line); - return; - } - std::stringstream s(line); - int count = 0; - char param[1024]; - char* pptr = param; - n.clear(); - int item = 0; - while (!s.eof()) - { - char c = 0; - s.get(c); - if (c == ' ') - { - *pptr = 0; - if (*param) - n.push_back(param); - *param = count = 0; - pptr = param; - item++; - } - else - { - if (!s.eof()) - { - *pptr++ = c; - count++; - } - if ((*param == ':') && (count == 1) && (item > 0)) - { - *param = count = 0; - pptr = param; - while (!s.eof()) - { - s.get(c); - if (!s.eof()) - { - *pptr++ = c; - count++; - } - } - *pptr = 0; - n.push_back(param); - *param = count = 0; - pptr = param; - } - } - } - *pptr = 0; - if (*param) - { + irc::tokenstream tokens(line); + std::string param; + while ((param = tokens.GetToken()) != "") n.push_back(param); - } - return; } @@ -2258,7 +2199,7 @@ class TreeSocket : public InspSocket log(DEBUG,"IN: %s", line.c_str()); - this->Split(line.c_str(),true,params); + this->Split(line.c_str(),params); if ((params[0][0] == ':') && (params.size() > 1)) { -- 2.39.2