summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-07-26 20:31:27 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-07-26 20:31:27 +0000
commit99795271eb95232d826a55988748ca16081ba677 (patch)
tree62d48aabd1944b147a191033f94910afb0234395
parent50c3145225c49c8a71ee134b26639e4fe09264a2 (diff)
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
-rw-r--r--src/modules/m_spanningtree.cpp69
1 files 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<std::string> &n)
+ void Split(std::string line, std::deque<std::string> &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))
{