From 777827ecd0954aca86de853bb0a5982e5315bd79 Mon Sep 17 00:00:00 2001 From: brain Date: Sun, 5 Mar 2006 22:21:42 +0000 Subject: 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 --- src/modules/m_spanningtree.cpp | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) (limited to 'src/modules') 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 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)) -- cgit v1.2.3