summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorom <om@e03df62e-2008-0410-955e-edbf42e46eb7>2006-07-01 11:42:09 +0000
committerom <om@e03df62e-2008-0410-955e-edbf42e46eb7>2006-07-01 11:42:09 +0000
commit3cf1ae04704b4f1706daa1077b90fd14d1e72cef (patch)
tree05e914b6723cff559175d41389f2c15d52fa4b24 /src/modules
parenta3a9d3e0f0b9680bdb9e8700dc6a43b9c8278977 (diff)
Replace rather craq'y loop with a couple of std::string calls
Change GetServerDescription to take const char* rather than char* Change userrec::server from char* to const char*, this is more 'correct' as it's not safe to modify it (pointer as returned by std::string::c_str()) Change WhoWasGroup::server, see above about userrec::server git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4094 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_spanningtree.cpp24
1 files changed, 12 insertions, 12 deletions
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)