]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_spanningtree/treesocket2.cpp
Fix typo.
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / treesocket2.cpp
index b1ecff060806a67a2706b69e730117c64398db16..15a7898ed992ae24aa34bc900464306495ca4f65 100644 (file)
@@ -73,7 +73,7 @@ void TreeSocket::ProcessLine(std::string &line)
        std::string command;
        parameterlist params;
 
-       ServerInstance->Logs->Log("m_spanningtree",DEBUG, "S[%d] I %s", this->GetFd(), line.c_str());
+       ServerInstance->Logs->Log("m_spanningtree", RAWIO, "S[%d] I %s", this->GetFd(), line.c_str());
 
        Split(line, prefix, command, params);
 
@@ -157,7 +157,7 @@ void TreeSocket::ProcessLine(std::string &line)
 
                                Utils->timeoutlist.erase(this);
                                parameterlist sparams;
-                               Utils->DoOneToAllButSender(prefix, "BURST", params, MyRoot->GetName());
+                               Utils->DoOneToAllButSender(MyRoot->GetID(), "BURST", params, MyRoot->GetName());
                                MyRoot->bursting = true;
                                this->DoBurst(MyRoot);
                        }
@@ -210,11 +210,7 @@ void TreeSocket::ProcessConnectedLine(std::string& prefix, std::string& command,
        User* who = ServerInstance->FindUUID(prefix);
        std::string direction;
 
-       if (who)
-       {
-               direction = who->server;
-       }
-       else
+       if (!who)
        {
                TreeServer* ServerSource = Utils->FindServer(prefix);
                if (prefix.empty())
@@ -223,7 +219,6 @@ void TreeSocket::ProcessConnectedLine(std::string& prefix, std::string& command,
                if (ServerSource)
                {
                        who = ServerSource->ServerUser;
-                       direction = prefix;
                }
                else
                {
@@ -238,6 +233,7 @@ void TreeSocket::ProcessConnectedLine(std::string& prefix, std::string& command,
        }
 
        // Make sure prefix is still good
+       direction = who->server;
        prefix = who->uuid;
 
        /*
@@ -419,18 +415,31 @@ void TreeSocket::ProcessConnectedLine(std::string& prefix, std::string& command,
        else
        {
                Command* cmd = ServerInstance->Parser->GetHandler(command);
-               CmdResult res = CMD_INVALID;
-               if (cmd && params.size() >= cmd->min_params)
+               
+               if (!cmd)
                {
-                       res = cmd->Handle(params, who);
+                       irc::stringjoiner pmlist(" ", params, 0, params.size() - 1);
+                       ServerInstance->Logs->Log("m_spanningtree", 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");
                }
 
+               if (params.size() < cmd->min_params)
+               {
+                       irc::stringjoiner pmlist(" ", params, 0, params.size() - 1);
+                       ServerInstance->Logs->Log("m_spanningtree", 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 + "'");
+               }
+
+               CmdResult res = cmd->Handle(params, who);
+
                if (res == CMD_INVALID)
                {
                        irc::stringjoiner pmlist(" ", params, 0, params.size() - 1);
-                       ServerInstance->Logs->Log("spanningtree", SPARSE, "Invalid S2S command :%s %s %s",
+                       ServerInstance->Logs->Log("m_spanningtree", SPARSE, "Error handling S2S command :%s %s %s",
                                who->uuid.c_str(), command.c_str(), pmlist.GetJoined().c_str());
-                       SendError("Unrecognised or malformed command '" + command + "' -- possibly loaded mismatched modules");
+                       SendError("Error handling '" + command + "' -- possibly loaded mismatched modules");
                }
                if (res == CMD_SUCCESS)
                        Utils->RouteCommand(route_back_again, command, params, who);