]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_spanningtree/treesocket2.cpp
Simplify stringjoiner: take 1 parameter, join from begin() to end() and use space...
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / treesocket2.cpp
index e91214041eb837ab1b3c293d0d35c8255d152b54..42fb708a9589052bbc2c0a84381978c8fa884eca 100644 (file)
@@ -160,9 +160,21 @@ void TreeSocket::ProcessLine(std::string &line)
                                                ServerInstance->SNO->WriteGlobalSno('l',"\2WARNING\2: Your clocks are out by %d seconds. Please consider synching your clocks.", abs((long)delta));
                                        }
                                }
+
+                               // Check for duplicate server name/sid again, it's possible that a new
+                               // server was introduced while we were waiting for them to send BURST.
+                               // (we do not reserve their server name/sid when they send SERVER, we do it now)
+                               if (!CheckDuplicate(capab->name, capab->sid))
+                                       return;
+
                                this->LinkState = CONNECTED;
                                Utils->timeoutlist.erase(this);
 
+                               linkID = capab->name;
+
+                               MyRoot = new TreeServer(Utils, capab->name, capab->description, capab->sid, Utils->TreeRoot, this, capab->hidden);
+                               Utils->TreeRoot->AddChild(MyRoot);
+
                                MyRoot->bursting = true;
                                this->DoBurst(MyRoot);
 
@@ -241,7 +253,7 @@ void TreeSocket::ProcessConnectedLine(std::string& prefix, std::string& command,
                         * crossing the users QUIT further upstream from the server. Thanks jilles!
                         */
 
-                       if ((prefix.length() == UUID_LENGTH-1) && (isdigit(prefix[0])) &&
+                       if ((prefix.length() == UIDGenerator::UUID_LENGTH) && (isdigit(prefix[0])) &&
                                ((command == "FMODE") || (command == "MODE") || (command == "KICK") || (command == "TOPIC") || (command == "KILL") || (command == "ADDLINE") || (command == "DELLINE")))
                        {
                                /* Special case, we cannot drop these commands as they've been committed already on a
@@ -286,7 +298,7 @@ void TreeSocket::ProcessConnectedLine(std::string& prefix, std::string& command,
        if ((!route_back_again) || (route_back_again->GetSocket() != this))
        {
                if (route_back_again)
-                       ServerInstance->Logs->Log("m_spanningtree",LOG_DEBUG,"Protocol violation: Fake direction '%s' from connection '%s'",
+                       ServerInstance->Logs->Log("m_spanningtree", LOG_DEBUG, "Protocol violation: Fake direction '%s' from connection '%s'",
                                prefix.c_str(),linkID.c_str());
                return;
        }
@@ -451,7 +463,7 @@ void TreeSocket::ProcessConnectedLine(std::string& prefix, std::string& command,
                                return;
                        }
                }
-               who->ForceNickChange(params[0].c_str());
+               who->ForceNickChange(params[0]);
                Utils->RouteCommand(route_back_again, command, params, who);
        }
        else
@@ -460,7 +472,7 @@ void TreeSocket::ProcessConnectedLine(std::string& prefix, std::string& command,
 
                if (!cmd)
                {
-                       irc::stringjoiner pmlist(" ", params, 0, params.size() - 1);
+                       irc::stringjoiner pmlist(params);
                        ServerInstance->Logs->Log("m_spanningtree", LOG_SPARSE, "Unrecognised S2S command :%s %s %s",
                                who->uuid.c_str(), command.c_str(), pmlist.GetJoined().c_str());
                        SendError("Unrecognised command '" + command + "' -- possibly loaded mismatched modules");
@@ -469,7 +481,7 @@ void TreeSocket::ProcessConnectedLine(std::string& prefix, std::string& command,
 
                if (params.size() < cmd->min_params)
                {
-                       irc::stringjoiner pmlist(" ", params, 0, params.size() - 1);
+                       irc::stringjoiner pmlist(params);
                        ServerInstance->Logs->Log("m_spanningtree", LOG_SPARSE, "Insufficient parameters for S2S command :%s %s %s",
                                who->uuid.c_str(), command.c_str(), pmlist.GetJoined().c_str());
                        SendError("Insufficient parameters for command '" + command + "'");
@@ -488,7 +500,7 @@ void TreeSocket::ProcessConnectedLine(std::string& prefix, std::string& command,
 
                if (res == CMD_INVALID)
                {
-                       irc::stringjoiner pmlist(" ", params, 0, params.size() - 1);
+                       irc::stringjoiner pmlist(params);
                        ServerInstance->Logs->Log("m_spanningtree", LOG_SPARSE, "Error handling S2S command :%s %s %s",
                                who->uuid.c_str(), command.c_str(), pmlist.GetJoined().c_str());
                        SendError("Error handling '" + command + "' -- possibly loaded mismatched modules");