]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_spanningtree/treesocket2.cpp
Add DYING link state, push error messages on link, and only limit recvq on unauthenti...
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / treesocket2.cpp
index f36bab7ac9322f7838ccca092b6ea7f78fddfa89..aacbbc25f68b9a52b5bc576b3b7e6efb90f94a7b 100644 (file)
@@ -2,7 +2,7 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
+ *  InspIRCd: (C) 2002-2010 InspIRCd Development Team
  * See: http://wiki.inspircd.org/Credits
  *
  * This program is free but copyrighted software; see
 #include "resolvers.h"
 
 /* Handle ERROR command */
-bool TreeSocket::Error(parameterlist &params)
+void TreeSocket::Error(parameterlist &params)
 {
-       if (params.size() < 1)
-               return false;
-       ServerInstance->SNO->WriteGlobalSno('l',"ERROR from %s: %s",(!InboundServerName.empty() ? InboundServerName.c_str() : myhost.c_str()),params[0].c_str());
-       /* we will return false to cause the socket to close. */
-       return false;
+       std::string msg = params.size() ? params[0] : "";
+       SetError("received ERROR " + msg);
 }
 
 void TreeSocket::Split(const std::string& line, std::string& prefix, std::string& command, parameterlist& params)
@@ -222,6 +219,8 @@ void TreeSocket::ProcessLine(std::string &line)
                         */
                        this->ProcessConnectedLine(prefix, command, params);
                break;
+               case DYING:
+               break;
        }
 }
 
@@ -242,9 +241,7 @@ void TreeSocket::ProcessConnectedLine(std::string& prefix, std::string& command,
 
                if (ServerSource)
                {
-                       who = Utils->ServerUser;
-                       Utils->ServerUser->SetFakeServer(ServerSource->GetName());
-                       Utils->ServerUser->uuid = ServerSource->GetID();
+                       who = ServerSource->ServerUser;
                        direction = prefix;
                }
                else
@@ -295,27 +292,7 @@ void TreeSocket::ProcessConnectedLine(std::string& prefix, std::string& command,
                command = "MODE";
 
        // TODO move all this into Commands
-       if (command == "UID")
-       {
-               this->ParseUID(prefix, params);
-       }
-       else if (command == "FJOIN")
-       {
-               this->ForceJoin(prefix,params);
-       }
-       else if (command == "STATS")
-       {
-               this->Stats(prefix, params);
-       }
-       else if (command == "MOTD")
-       {
-               this->Motd(prefix, params);
-       }
-       else if (command == "ADMIN")
-       {
-               this->Admin(prefix, params);
-       }
-       else if (command == "MAP")
+       if (command == "MAP")
        {
                Utils->Creator->HandleMap(params, who);
        }
@@ -327,26 +304,10 @@ void TreeSocket::ProcessConnectedLine(std::string& prefix, std::string& command,
        {
                this->Error(params);
        }
-       else if (command == "OPERTYPE")
-       {
-               this->OperType(prefix,params);
-       }
        else if (command == "AWAY")
        {
                this->Away(prefix,params);
        }
-       else if (command == "FMODE")
-       {
-               this->ForceMode(prefix,params);
-       }
-       else if (command == "FTOPIC")
-       {
-               this->ForceTopic(prefix,params);
-       }
-       else if (command == "METADATA")
-       {
-               this->MetaData(prefix,params);
-       }
        else if (command == "PING")
        {
                this->LocalPing(prefix,params);
@@ -365,18 +326,6 @@ void TreeSocket::ProcessConnectedLine(std::string& prefix, std::string& command,
        {
                this->ServerVersion(prefix,params);
        }
-       else if (command == "FHOST")
-       {
-               this->ChangeHost(prefix,params);
-       }
-       else if (command == "FNAME")
-       {
-               this->ChangeName(prefix,params);
-       }
-       else if (command == "FIDENT")
-       {
-               this->ChangeIdent(prefix,params);
-       }
        else if (command == "ADDLINE")
        {
                this->AddLine(prefix,params);
@@ -385,10 +334,6 @@ void TreeSocket::ProcessConnectedLine(std::string& prefix, std::string& command,
        {
                this->DelLine(prefix,params);
        }
-       else if (command == "SVSNICK")
-       {
-               this->SVSNick(prefix,params);
-       }
        else if (command == "SAVE")
        {
                this->ForceNick(prefix,params);
@@ -405,18 +350,6 @@ void TreeSocket::ProcessConnectedLine(std::string& prefix, std::string& command,
        {
                this->Push(prefix,params);
        }
-       else if (command == "TIME")
-       {
-               this->Time(prefix,params);
-       }
-       else if (command == "SVSJOIN")
-       {
-               this->ServiceJoin(prefix,params);
-       }
-       else if (command == "SVSPART")
-       {
-               this->ServicePart(prefix,params);
-       }
        else if (command == "SQUIT")
        {
                if (params.size() == 2)
@@ -424,33 +357,25 @@ void TreeSocket::ProcessConnectedLine(std::string& prefix, std::string& command,
                        this->Squit(Utils->FindServer(params[0]),params[1]);
                }
        }
-       else if (command == "MODENOTICE")
-       {
-               if (params.size() >= 2)
-               {
-                       ServerInstance->Users->WriteMode(params[0].c_str(), WM_AND, "*** From %s: %s",
-                               who->nick.c_str(), params[1].c_str());
-               }
-               Utils->DoOneToAllButSender(prefix, command, params, prefix);
-       }
        else if (command == "SNONOTICE")
        {
                if (params.size() >= 2)
                {
-                       ServerInstance->SNO->WriteGlobalSno(*(params[0].c_str()), "From " + who->nick + ": "+ params[1]);
+                       ServerInstance->SNO->WriteToSnoMask(*(params[0].c_str()), "From " + who->nick + ": "+ params[1]);
                        Utils->DoOneToAllButSender(prefix, command, params, prefix);
                }
        }
        else if (command == "BURST")
        {
                // Set prefix server as bursting
-               if (!IS_SERVER(who))
+               TreeServer* ServerSource = Utils->FindServer(prefix);
+               if (!ServerSource)
                {
                        ServerInstance->SNO->WriteGlobalSno('l', "WTF: Got BURST from a non-server(?): %s", prefix.c_str());
                        return;
                }
 
-               route_back_again->bursting = true;
+               ServerSource->bursting = true;
                Utils->DoOneToAllButSender(prefix, command, params, prefix);
        }
        else if (command == "ENDBURST")
@@ -467,7 +392,7 @@ void TreeSocket::ProcessConnectedLine(std::string& prefix, std::string& command,
        }
        else if (command == "ENCAP")
        {
-               this->Encap(prefix, params);
+               this->Encap(who, params);
        }
        else if (command == "NICK")
        {