summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/helperfuncs.cpp2
-rw-r--r--src/modules/m_spanningtree.cpp24
2 files changed, 13 insertions, 13 deletions
diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp
index c51a824a8..a30a669ae 100644
--- a/src/helperfuncs.cpp
+++ b/src/helperfuncs.cpp
@@ -670,7 +670,7 @@ void ChanExceptSender_NoFormat(chanrec* Ptr, userrec* user, char status, const c
}
}
-std::string GetServerDescription(char* servername)
+std::string GetServerDescription(const char* servername)
{
std::string description = "";
diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp
index dc50140b2..efedb2b8c 100644
--- a/src/modules/m_spanningtree.cpp
+++ b/src/modules/m_spanningtree.cpp
@@ -1147,18 +1147,17 @@ class TreeSocket : public InspSocket
// NICK age nick host dhost ident +modes ip :gecos
// 0 123 4 56 7
time_t age = atoi(params[0].c_str());
- std::string modes = params[5];
- while (*(modes.c_str()) == '+')
- {
- char* m = (char*)modes.c_str();
- m++;
- modes = m;
- }
- char* tempnick = (char*)params[1].c_str();
+
+ /* This used to have a pretty craq'y loop doing the same thing,
+ * now we just let the STL do the hard work (more efficiently)
+ */
+ params[5] = params[5].substr(params[5].find_first_not_of('+'));
+
+ const char* tempnick = params[1].c_str();
log(DEBUG,"Introduce client %s!%s@%s",tempnick,params[4].c_str(),params[2].c_str());
- user_hash::iterator iter;
- iter = clientlist.find(tempnick);
+ user_hash::iterator iter = clientlist.find(tempnick);
+
if (iter != clientlist.end())
{
// nick collision
@@ -1172,12 +1171,13 @@ class TreeSocket : public InspSocket
strlcpy(clientlist[tempnick]->nick, tempnick,NICKMAX-1);
strlcpy(clientlist[tempnick]->host, params[2].c_str(),63);
strlcpy(clientlist[tempnick]->dhost, params[3].c_str(),63);
- clientlist[tempnick]->server = (char*)FindServerNamePtr(source.c_str());
+ clientlist[tempnick]->server = FindServerNamePtr(source.c_str());
strlcpy(clientlist[tempnick]->ident, params[4].c_str(),IDENTMAX);
strlcpy(clientlist[tempnick]->fullname, params[7].c_str(),MAXGECOS);
clientlist[tempnick]->registered = 7;
clientlist[tempnick]->signon = age;
- strlcpy(clientlist[tempnick]->modes, modes.c_str(),53);
+ strlcpy(clientlist[tempnick]->modes, params[5].c_str(),53);
+
for (char *v = clientlist[tempnick]->modes; *v; v++)
{
switch (*v)