]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_spanningtree/server.cpp
Remove now needless User::ForceNickChange()
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / server.cpp
index 538d28dbdd52bd49afd613cb80b9c52c7b47a146..69cae001c6f13f20ff2d4cb0116b7b84984c34f8 100644 (file)
  * Some server somewhere in the network introducing another server.
  *     -- w
  */
-CmdResult CommandServer::Handle(User* user, std::vector<std::string>& params)
+CmdResult CommandServer::HandleServer(TreeServer* ParentOfThis, std::vector<std::string>& params)
 {
        std::string servername = params[0];
        // password is not used for a remote server
        // hopcount is not used (ever)
        std::string sid = params[3];
        std::string description = params[4];
-       TreeServer* ParentOfThis = Utils->FindServer(user->server);
        TreeSocket* socket = ParentOfThis->GetSocket();
 
-       if (!IS_SERVER(user))
-               return CMD_FAILURE;
-
        if (!InspIRCd::IsSID(sid))
        {
                socket->SendError("Invalid format server ID: "+sid+"!");
@@ -146,11 +142,8 @@ bool TreeSocket::Outbound_Reply_Server(parameterlist &params)
                Utils->TreeRoot->AddChild(MyRoot);
                this->DoBurst(MyRoot);
 
-               params[4] = ":" + params[4];
-
-               /* IMPORTANT: Take password/hmac hash OUT of here before we broadcast the introduction! */
-               params[1] = "*";
-               Utils->DoOneToAllButSender(ServerInstance->Config->GetSID(),"SERVER",params,sname);
+               // This will send a * in place of the password/hmac
+               CommandServer::Builder(MyRoot).Forward(MyRoot);
 
                return true;
        }
@@ -252,3 +245,11 @@ bool TreeSocket::Inbound_Server(parameterlist &params)
        return false;
 }
 
+CommandServer::Builder::Builder(TreeServer* server)
+       : CmdBuilder(server->GetParent()->GetID(), "SERVER")
+{
+       push(server->GetName());
+       push_raw(" * 0 ");
+       push_raw(server->GetID());
+       push_last(server->GetDesc());
+}