]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_spanningtree/treesocket2.cpp
Make VF_OPTCOMMON module mismatches a fatal link error by default
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / treesocket2.cpp
index 68b5a784091cb4f5d7d61fc6056ce4c74c08fe9b..79ab791d356e86914131ad3c9767db1696c7bb9d 100644 (file)
 #include "commands/cmd_stats.h"
 #include "socket.h"
 #include "xline.h"
-#include "transport.h"
+#include "../transport.h"
 #include "socketengine.h"
 
-#include "m_spanningtree/main.h"
-#include "m_spanningtree/utils.h"
-#include "m_spanningtree/treeserver.h"
-#include "m_spanningtree/link.h"
-#include "m_spanningtree/treesocket.h"
-#include "m_spanningtree/resolvers.h"
-#include "m_spanningtree/handshaketimer.h"
+#include "main.h"
+#include "utils.h"
+#include "treeserver.h"
+#include "link.h"
+#include "treesocket.h"
+#include "resolvers.h"
+#include "handshaketimer.h"
 
 /* $ModDep: m_spanningtree/resolvers.h m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/link.h m_spanningtree/treesocket.h m_spanningtree/handshaketimer.h */
 
@@ -38,7 +38,7 @@ void TreeSocket::WriteLine(std::string line)
 
 
 /* Handle ERROR command */
-bool TreeSocket::Error(std::deque<std::string> &params)
+bool TreeSocket::Error(parameterlist &params)
 {
        if (params.size() < 1)
                return false;
@@ -47,7 +47,7 @@ bool TreeSocket::Error(std::deque<std::string> &params)
        return false;
 }
 
-void TreeSocket::Split(const std::string &line, std::deque<std::string> &n)
+void TreeSocket::Split(const std::string &line, parameterlist &n)
 {
        n.clear();
        irc::tokenstream tokens(line);
@@ -61,7 +61,7 @@ void TreeSocket::Split(const std::string &line, std::deque<std::string> &n)
 
 bool TreeSocket::ProcessLine(std::string &line)
 {
-       std::deque<std::string> params;
+       parameterlist params;
        irc::string command;
        std::string prefix;
 
@@ -80,17 +80,20 @@ bool TreeSocket::ProcessLine(std::string &line)
        if ((params[0][0] == ':') && (params.size() > 1))
        {
                prefix = params[0].substr(1);
-               params.pop_front();
 
                if (prefix.empty())
                {
-                       this->SendError("BUG (?) Empty prefix recieved.");
+                       this->SendError("BUG (?) Empty prefix recieved: " + line);
                        return false;
                }
+               command = params[1].c_str();
+               params.erase(params.begin(), params.begin() + 2);
+       }
+       else
+       {
+               command = params[0].c_str();
+               params.erase(params.begin());
        }
-
-       command = params[0].c_str();
-       params.pop_front();
 
        switch (this->LinkState)
        {
@@ -299,9 +302,7 @@ bool TreeSocket::ProcessLine(std::string &line)
                        TreeServer *ServerSource = Utils->FindServer(prefix);
                        if (ServerSource)
                        {
-                               // ServerSource->GetName().c_str() may become invalid before it is used
-                               Utils->ServerUser->nick = ServerSource->GetName().c_str();
-                               Utils->ServerUser->server = Utils->ServerUser->nick.c_str();
+                               Utils->ServerUser->SetFakeServer(ServerSource->GetName());
                                Utils->ServerUser->uuid = ServerSource->GetID();
                        }
 
@@ -353,8 +354,7 @@ bool TreeSocket::ProcessLine(std::string &line)
                                User* user = ServerInstance->FindNick(prefix);
                                if (user)
                                {
-                                       std::vector<std::string> p(params.begin(), params.end());
-                                       return Utils->Creator->HandleMap(p, user);
+                                       return Utils->Creator->HandleMap(params, user);
                                }
                        }
                        else if (command == "SERVER")
@@ -562,10 +562,7 @@ bool TreeSocket::ProcessLine(std::string &line)
                                        }
                                }
 
-                               // it's a user
-                               std::vector<std::string> strparams(params.begin(), params.end());
-
-                               switch (this->ServerInstance->CallCommandHandler(command.c_str(), strparams, who))
+                               switch (this->ServerInstance->CallCommandHandler(command.c_str(), params, who))
                                {
                                        case CMD_INVALID:
                                                /*