]> 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 017b9ddb3fb44e66ab1506f2ff50ab315dbe9b1c..1c624f5c4875e1ed8e35a73bf0765f7ca7865a38 100644 (file)
@@ -34,9 +34,7 @@
 CmdResult CommandServer::HandleServer(TreeServer* ParentOfThis, std::vector<std::string>& params)
 {
        const std::string& servername = params[0];
-       // password is not used for a remote server
-       // hopcount is not used (ever)
-       const std::string& sid = params[3];
+       const std::string& sid = params[1];
        const std::string& description = params.back();
        TreeSocket* socket = ParentOfThis->GetSocket();
 
@@ -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)
@@ -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());
 }