]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_spanningtree/postcommand.cpp
Move destruction logic for User and Spanningtree into cull()
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / postcommand.cpp
index 0988fe0991b3413be59b14c3f82c5bd9bbbf9ee4..1b1f618b8a2907d7bd5640322840b64c4d8f3009 100644 (file)
@@ -14,8 +14,6 @@
 /* $ModDesc: Provides a spanning tree server link protocol */
 
 #include "inspircd.h"
-#include "commands/cmd_whois.h"
-#include "commands/cmd_stats.h"
 #include "socket.h"
 #include "xline.h"
 #include "../transport.h"
@@ -54,15 +52,24 @@ void ModuleSpanningTree::OnPostCommand(const std::string &command, const std::ve
        }
        else if (routing.type == ROUTE_TYPE_OPT_UCAST)
        {
-               params.push_back(routing.serverdest);
+               TreeServer* sdest = Utils->FindServer(routing.serverdest);
+               if (!sdest)
+               {
+                       ServerInstance->Logs->Log("m_spanningtree",ERROR,"Trying to route ENCAP to nonexistant server %s",
+                               routing.serverdest.c_str());
+                       return;
+               }
+               params.push_back(sdest->GetID());
                params.push_back(command);
                sent_cmd = "ENCAP";
        }
        else
        {
                Module* srcmodule = thiscmd->creator;
+               Version ver = srcmodule->GetVersion();
 
-               if (srcmodule && !(srcmodule->GetVersion().Flags & VF_COMMON)) {
+               if (!(ver.Flags & VF_COMMON))
+               {
                        ServerInstance->Logs->Log("m_spanningtree",ERROR,"Routed command %s from non-VF_COMMON module %s",
                                command.c_str(), srcmodule->ModuleSourceFile.c_str());
                        return;