]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_spanningtree/server.cpp
Merge branch 'master+stfjoinforward'
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / server.cpp
index 8686b43e523d3f58f9c2be181d180bbf2b05f13c..1c624f5c4875e1ed8e35a73bf0765f7ca7865a38 100644 (file)
  */
 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];
+       const std::string& servername = params[0];
+       const std::string& sid = params[1];
+       const std::string& description = params.back();
        TreeSocket* socket = ParentOfThis->GetSocket();
 
        if (!InspIRCd::IsSID(sid))
@@ -65,11 +63,32 @@ CmdResult CommandServer::HandleServer(TreeServer* ParentOfThis, std::vector<std:
 
        TreeServer* Node = new TreeServer(servername, description, sid, ParentOfThis, ParentOfThis->GetSocket(), lnk ? lnk->Hidden : false);
 
-       ParentOfThis->AddChild(Node);
+       HandleExtra(Node, params);
+
        ServerInstance->SNO->WriteToSnoMask('L', "Server \002"+ParentOfThis->GetName()+"\002 introduced server \002"+servername+"\002 ("+description+")");
        return CMD_SUCCESS;
 }
 
+void CommandServer::HandleExtra(TreeServer* newserver, const std::vector<std::string>& params)
+{
+       for (std::vector<std::string>::const_iterator i = params.begin() + 2; i != params.end() - 1; ++i)
+       {
+               const std::string& prop = *i;
+               std::string::size_type p = prop.find('=');
+
+               std::string key = prop;
+               std::string val;
+               if (p != std::string::npos)
+               {
+                       key.erase(p);
+                       val.assign(prop, p+1, std::string::npos);
+               }
+
+               if (key == "burst")
+                       newserver->BeginBurst(ConvToInt(val));
+       }
+}
+
 Link* TreeSocket::AuthRemote(const parameterlist& params)
 {
        if (params.size() < 5)
@@ -79,10 +98,10 @@ Link* TreeSocket::AuthRemote(const parameterlist& params)
        }
 
        irc::string servername = params[0].c_str();
-       std::string sname = params[0];
-       std::string password = params[1];
-       std::string sid = params[3];
-       std::string description = params[4];
+       const std::string& sname = params[0];
+       const std::string& password = params[1];
+       const std::string& sid = params[3];
+       const std::string& description = params.back();
 
        this->SendCapabilities(2);
 
@@ -199,7 +218,8 @@ CommandServer::Builder::Builder(TreeServer* server)
        : CmdBuilder(server->GetParent()->GetID(), "SERVER")
 {
        push(server->GetName());
-       push_raw(" * 0 ");
-       push_raw(server->GetID());
+       push(server->GetID());
+       if (server->IsBursting())
+               push_property("burst", ConvToStr(server->StartBurst));
        push_last(server->GetDesc());
 }