]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_spanningtree/uid.cpp
Clean this up a bit, and log about ignoring link blocks due to missing attributes
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / uid.cpp
index 0768ec16f8d34eff09ba01d76776c1f06338704c..e539e0b18d1b4898702e2c1bf7e94f8a74f94155 100644 (file)
@@ -38,8 +38,9 @@ bool TreeSocket::ParseUID(const std::string &source, std::deque<std::string> &pa
         */
        if (params.size() != 10)
        {
-               this->WriteLine(std::string(":")+this->Instance->Config->GetSID()+" KILL "+params[0]+" :Invalid client introduction ("+params[0]+" with only "+
-                               ConvToStr(params.size())+" of 10 parameters?)");
+               if (!params.empty())
+                       this->WriteLine(std::string(":")+this->Instance->Config->GetSID()+" KILL "+params[0]+" :Invalid client introduction ("+params[0]+" with only "+
+                                       ConvToStr(params.size())+" of 10 parameters?)");
                return true;
        }
 
@@ -84,13 +85,14 @@ bool TreeSocket::ParseUID(const std::string &source, std::deque<std::string> &pa
                /*
                 * Nick collision.
                 */
-               Instance->Log(DEBUG,"*** Collision on %s", tempnick);
+               Instance->Logs->Log("m_spanningtree",DEBUG,"*** Collision on %s", tempnick);
                int collide = this->DoCollision(iter->second, age_t, params[5].c_str(), params[7].c_str(), params[0].c_str());
 
                if (collide == 2)
                {
                        /* remote client changed, make sure we change their nick for the hash too */
                        tempnick = params[0].c_str();
+                       params[2] = params[0];
                }
        }
 
@@ -109,12 +111,12 @@ bool TreeSocket::ParseUID(const std::string &source, std::deque<std::string> &pa
        }
        (*(this->Instance->Users->clientlist))[tempnick] = _new;
        _new->SetFd(FD_MAGIC_NUMBER);
-       strlcpy(_new->nick, tempnick, NICKMAX - 1);
-       strlcpy(_new->host, params[3].c_str(),64);
-       strlcpy(_new->dhost, params[4].c_str(),64);
+       _new->nick.assign(tempnick, NICKMAX - 1);
+       _new->host.assign(params[3], 0, 64);
+       _new->dhost.assign(params[4], 0, 64);
        _new->server = this->Instance->FindServerNamePtr(remoteserver->GetName().c_str());
-       strlcpy(_new->ident, params[5].c_str(),IDENTMAX + 1);
-       strlcpy(_new->fullname, params[9].c_str(),MAXGECOS);
+       _new->ident.assign(params[5], 0, IDENTMAX + 1);
+       _new->fullname.assign(params[9], 0, MAXGECOS);
        _new->registered = REG_ALL;
        _new->signon = signon;
        _new->age = age_t;
@@ -155,7 +157,7 @@ bool TreeSocket::ParseUID(const std::string &source, std::deque<std::string> &pa
                dosend = false;
        
        if (dosend)
-               this->Instance->SNO->WriteToSnoMask('C',"Client connecting at %s: %s!%s@%s [%s] [%s]",_new->server,_new->nick,_new->ident,_new->host, _new->GetIPString(), _new->fullname);
+               this->Instance->SNO->WriteToSnoMask('C',"Client connecting at %s: %s!%s@%s [%s] [%s]", _new->server, _new->nick.c_str(), _new->ident.c_str(), _new->host.c_str(), _new->GetIPString(), _new->fullname.c_str());
 
        params[9] = ":" + params[9];
        Utils->DoOneToAllButSender(source, "UID", params, source);