diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-03-05 22:21:42 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-03-05 22:21:42 +0000 |
commit | 777827ecd0954aca86de853bb0a5982e5315bd79 (patch) | |
tree | 93ba33ffb4c1594b2cc2b890573124f111cc5817 /src/modules/m_spanningtree.cpp | |
parent | 5234aca22c91100baf394e82984c569daee1ae8b (diff) |
Tidied up ProcessLine, instead of a ton of strlens use a tiny bit of char* voodoo
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3473 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_spanningtree.cpp')
-rw-r--r-- | src/modules/m_spanningtree.cpp | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp index 16000a5ec..5257d563d 100644 --- a/src/modules/m_spanningtree.cpp +++ b/src/modules/m_spanningtree.cpp @@ -1141,7 +1141,7 @@ class TreeSocket : public InspSocket { char* o = i->second; userrec* otheruser = (userrec*)o; - strlcat(list," ",MAXBUF); + charlcat(list,' ',MAXBUF); int x = cflags(otheruser,c); if ((x & UCMODE_HOP) && (x & UCMODE_OP)) { @@ -1152,21 +1152,23 @@ class TreeSocket : public InspSocket specific_voice.push_back(otheruser); } - char* n = ""; + char n = 0; if (x & UCMODE_OP) { - n = "@"; + n = '@'; } else if (x & UCMODE_HOP) { - n = "%"; + n = '%'; } else if (x & UCMODE_VOICE) { - n = "+"; + n = '+'; } - strlcat(list,n,MAXBUF); + if (n) + charlcat(list,n,MAXBUF); + strlcat(list,otheruser->nick,MAXBUF); if (strlen(list)>(480-NICKMAX)) { @@ -2148,15 +2150,18 @@ class TreeSocket : public InspSocket bool ProcessLine(std::string line) { char* l = (char*)line.c_str(); - while ((strlen(l)) && (l[strlen(l)-1] == '\r') || (l[strlen(l)-1] == '\n')) - l[strlen(l)-1] = '\0'; - line = l; - if (line == "") + for (char* x = l; *x; x++) + { + if ((*x == '\r') || (*x == '\n')) + *x = 0; + } + if (!*l) return true; - Srv->Log(DEBUG,"IN: "+line); - + + log(DEBUG,"IN: %s",l); + std::deque<std::string> params; - this->Split(line,true,params); + this->Split(l,true,params); irc::string command = ""; std::string prefix = ""; if (((params[0].c_str())[0] == ':') && (params.size() > 1)) |