* 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+"!");
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;
}
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());
+}