]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_spanningtree/precommand.cpp
Fix memory leaks on reloadmodule and spanningtree unload while connecting servers
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / precommand.cpp
index 86b31143eaae38a61db74df8bab422904b9a515d..c43e4e927c12566bb173dfc517a21838791887eb 100644 (file)
 /* $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"
 
 #include "main.h"
 #include "utils.h"
 
 /* $ModDep: m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/treesocket.h */
 
-int ModuleSpanningTree::OnPreCommand(std::string &command, std::vector<std::string>& parameters, User *user, bool validated, const std::string &original_line)
+ModResult ModuleSpanningTree::OnPreCommand(std::string &command, std::vector<std::string>& parameters, User *user, bool validated, const std::string &original_line)
 {
        /* If the command doesnt appear to be valid, we dont want to mess with it. */
        if (!validated)
-               return 0;
+               return MOD_RES_PASSTHRU;
 
        if (command == "CONNECT")
        {
@@ -55,7 +52,7 @@ int ModuleSpanningTree::OnPreCommand(std::string &command, std::vector<std::stri
        }
        else if (command == "MAP")
        {
-               return this->HandleMap(parameters,user);
+               return this->HandleMap(parameters,user) ? MOD_RES_DENY : MOD_RES_PASSTHRU;
        }
        else if ((command == "TIME") && (parameters.size() > 0))
        {
@@ -64,12 +61,12 @@ int ModuleSpanningTree::OnPreCommand(std::string &command, std::vector<std::stri
        else if (command == "LUSERS")
        {
                this->HandleLusers(parameters,user);
-               return 1;
+               return MOD_RES_DENY;
        }
        else if (command == "LINKS")
        {
                this->HandleLinks(parameters,user);
-               return 1;
+               return MOD_RES_DENY;
        }
        else if (command == "WHOIS")
        {
@@ -82,12 +79,8 @@ int ModuleSpanningTree::OnPreCommand(std::string &command, std::vector<std::stri
        else if ((command == "VERSION") && (parameters.size() > 0))
        {
                this->HandleVersion(parameters,user);
-               return 1;
+               return MOD_RES_DENY;
        }
-       else if ((command == "MODULES") && (parameters.size() > 0))
-       {
-               return this->HandleModules(parameters,user);
-       }
-       return 0;
+       return MOD_RES_PASSTHRU;
 }