]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_spanningtree/netburst.cpp
m_spanningtree SVSNICK needs 3 parameters
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / netburst.cpp
index 8cd0dccd9ae78b7591d487108b2475b60290fd02..5248ea897e3a33dcc4ba5f4be58ba062cd2d2d68 100644 (file)
  */
 void TreeSocket::DoBurst(TreeServer* s)
 {
-       std::string name = s->GetName();
-       std::string burst = ":" + ServerInstance->Config->GetSID() + " BURST " +ConvToStr(ServerInstance->Time());
-       std::string endburst = ":" + ServerInstance->Config->GetSID() + " ENDBURST";
+       std::string servername = s->GetName();
        ServerInstance->SNO->WriteToSnoMask('l',"Bursting to \2%s\2 (Authentication: %s%s).",
-               name.c_str(),
+               servername.c_str(),
                capab->auth_fingerprint ? "SSL Fingerprint and " : "",
                capab->auth_challenge ? "challenge-response" : "plaintext password");
        this->CleanNegotiationInfo();
-       this->WriteLine(burst);
+       this->WriteLine(":" + ServerInstance->Config->GetSID() + " BURST " + ConvToStr(ServerInstance->Time()));
        /* send our version string */
-       this->WriteLine(std::string(":")+ServerInstance->Config->GetSID()+" VERSION :"+ServerInstance->GetVersionString());
+       this->WriteLine(":" + ServerInstance->Config->GetSID() + " VERSION :"+ServerInstance->GetVersionString());
        /* Send server tree */
        this->SendServers(Utils->TreeRoot,s,1);
        /* Send users and their oper status */
-       this->SendUsers(s);
+       this->SendUsers();
        /* Send everything else (channel modes, xlines etc) */
-       this->SendChannelModes(s);
-       this->SendXLines(s);
+       this->SendChannelModes();
+       this->SendXLines();
        FOREACH_MOD(I_OnSyncNetwork,OnSyncNetwork(Utils->Creator,(void*)this));
-       this->WriteLine(endburst);
-       ServerInstance->SNO->WriteToSnoMask('l',"Finished bursting to \2"+name+"\2.");
+       this->WriteLine(":" + ServerInstance->Config->GetSID() + " ENDBURST");
+       ServerInstance->SNO->WriteToSnoMask('l',"Finished bursting to \2"+ s->GetName()+"\2.");
 }
 
 /** Recursively send the server tree with distances as hops.
@@ -68,19 +66,18 @@ void TreeSocket::DoBurst(TreeServer* s)
  */
 void TreeSocket::SendServers(TreeServer* Current, TreeServer* s, int hops)
 {
-       char command[1024];
+       char command[MAXBUF];
        for (unsigned int q = 0; q < Current->ChildCount(); q++)
        {
                TreeServer* recursive_server = Current->GetChild(q);
                if (recursive_server != s)
                {
-                       std::string servername = Current->GetName();
                        std::string recursive_servername = recursive_server->GetName();
-                       snprintf(command,1024,":%s SERVER %s * %d %s :%s", servername.c_str(), recursive_servername.c_str(), hops,
+                       snprintf(command, MAXBUF, ":%s SERVER %s * %d %s :%s", Current->GetID().c_str(), recursive_servername.c_str(), hops,
                                        recursive_server->GetID().c_str(),
                                        recursive_server->GetDesc().c_str());
                        this->WriteLine(command);
-                       this->WriteLine(":"+recursive_server->GetName()+" VERSION :"+recursive_server->GetVersion());
+                       this->WriteLine(":"+recursive_server->GetID()+" VERSION :"+recursive_server->GetVersion());
                        /* down to next level */
                        this->SendServers(recursive_server, s, hops+1);
                }
@@ -91,7 +88,7 @@ void TreeSocket::SendServers(TreeServer* Current, TreeServer* s, int hops)
  * If the length of a single line is more than 480-NICKMAX
  * in length, it is split over multiple lines.
  */
-void TreeSocket::SendFJoins(TreeServer* Current, Channel* c)
+void TreeSocket::SendFJoins(Channel* c)
 {
        std::string buffer;
        char list[MAXBUF];
@@ -171,8 +168,8 @@ void TreeSocket::SendFJoins(TreeServer* Current, Channel* c)
        this->WriteLine(buffer);
 }
 
-/** Send G, Q, Z and E lines */
-void TreeSocket::SendXLines(TreeServer* Current)
+/** Send all XLines we know about */
+void TreeSocket::SendXLines()
 {
        char data[MAXBUF];
        std::string n = ServerInstance->Config->GetSID();
@@ -211,16 +208,16 @@ void TreeSocket::SendXLines(TreeServer* Current)
        }
 }
 
-/** Send channel modes and topics */
-void TreeSocket::SendChannelModes(TreeServer* Current)
+/** Send channel topic, modes and metadata */
+void TreeSocket::SendChannelModes()
 {
        char data[MAXBUF];
-       std::deque<std::string> list;
        std::string n = ServerInstance->Config->GetSID();
        const char* sn = n.c_str();
+
        for (chan_hash::iterator c = ServerInstance->chanlist->begin(); c != ServerInstance->chanlist->end(); c++)
        {
-               SendFJoins(Current, c->second);
+               SendFJoins(c->second);
                if (!c->second->topic.empty())
                {
                        snprintf(data,MAXBUF,":%s FTOPIC %s %lu %s :%s", sn, c->second->name.c_str(), (unsigned long)c->second->topicset, c->second->setby.c_str(), c->second->topic.c_str());
@@ -240,7 +237,7 @@ void TreeSocket::SendChannelModes(TreeServer* Current)
 }
 
 /** send all users and their oper state/modes */
-void TreeSocket::SendUsers(TreeServer* Current)
+void TreeSocket::SendUsers()
 {
        char data[MAXBUF];
        std::string dataline;