]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Change allocation of InspIRCd::Parser to be physically part of the object containing it
authorAttila Molnar <attilamolnar@hush.com>
Fri, 13 Jun 2014 13:45:55 +0000 (15:45 +0200)
committerAttila Molnar <attilamolnar@hush.com>
Fri, 13 Jun 2014 13:45:55 +0000 (15:45 +0200)
20 files changed:
include/inspircd.h
src/command_parse.cpp
src/configreader.cpp
src/coremods/core_info/cmd_commands.cpp
src/coremods/core_stats.cpp
src/inspircd.cpp
src/modules.cpp
src/modules/m_abbreviation.cpp
src/modules/m_alias.cpp
src/modules/m_ldapoper.cpp
src/modules/m_operlog.cpp
src/modules/m_passforward.cpp
src/modules/m_showfile.cpp
src/modules/m_silence.cpp
src/modules/m_spanningtree/encap.cpp
src/modules/m_spanningtree/idle.cpp
src/modules/m_spanningtree/treesocket2.cpp
src/modules/m_sqloper.cpp
src/modules/m_watch.cpp
src/users.cpp

index e575cd8b021726ffdffdebb025013ce52d467fb0..17dca94d56a2db489c3b8a11d0a7b4cfe485fe5d 100644 (file)
@@ -343,7 +343,7 @@ class CoreExport InspIRCd
 
        /** Command parser, handles client to server commands
         */
-       CommandParser* Parser;
+       CommandParser Parser;
 
        /** Thread engine, Handles threading where required
         */
index 82bfe09621897a561ffb74351bc21f0663afbc21..eed549deb1e064593980d526685c347881df2c22 100644 (file)
@@ -333,7 +333,7 @@ CommandBase::~CommandBase()
 
 Command::~Command()
 {
-       ServerInstance->Parser->RemoveCommand(this);
+       ServerInstance->Parser.RemoveCommand(this);
 }
 
 void CommandParser::ProcessBuffer(std::string &buffer,LocalUser *user)
index 945600e6c06f14eb4eb7f1b1aa1b13d4030a89cc..0ec53c482d8d4dbc21b59510cb2ed2cf5d521315 100644 (file)
@@ -69,14 +69,14 @@ bool ServerConfig::ApplyDisabledCommands(const std::string& data)
        std::string thiscmd;
 
        /* Enable everything first */
-       const CommandParser::CommandMap& commands = ServerInstance->Parser->GetCommands();
+       const CommandParser::CommandMap& commands = ServerInstance->Parser.GetCommands();
        for (CommandParser::CommandMap::const_iterator x = commands.begin(); x != commands.end(); ++x)
                x->second->Disable(false);
 
        /* Now disable all the ones which the user wants disabled */
        while (dcmds >> thiscmd)
        {
-               Command* handler = ServerInstance->Parser->GetHandler(thiscmd);
+               Command* handler = ServerInstance->Parser.GetHandler(thiscmd);
                if (handler)
                        handler->Disable(true);
        }
index 8b255a928a1382392732b1fa2513aef051b7efb5..3a892c5c4bffb260cb5cb5a80e207a6b4604b190 100644 (file)
@@ -31,7 +31,7 @@ CommandCommands::CommandCommands(Module* parent)
  */
 CmdResult CommandCommands::Handle (const std::vector<std::string>&, User *user)
 {
-       const CommandParser::CommandMap& commands = ServerInstance->Parser->GetCommands();
+       const CommandParser::CommandMap& commands = ServerInstance->Parser.GetCommands();
        std::vector<std::string> list;
        list.reserve(commands.size());
        for (CommandParser::CommandMap::const_iterator i = commands.begin(); i != commands.end(); ++i)
index 1e90ed2bfb00c87725e995cc442e12b92084272f..1ae2e168eba82bd639d06dc246ef1549fe65e1b4 100644 (file)
@@ -190,7 +190,7 @@ void CommandStats::DoStats(char statschar, User* user, string_list &results)
                /* stats m (list number of times each command has been used, plus bytecount) */
                case 'm':
                {
-                       const CommandParser::CommandMap& commands = ServerInstance->Parser->GetCommands();
+                       const CommandParser::CommandMap& commands = ServerInstance->Parser.GetCommands();
                        for (CommandParser::CommandMap::const_iterator i = commands.begin(); i != commands.end(); ++i)
                        {
                                if (i->second->use_count)
@@ -207,7 +207,7 @@ void CommandStats::DoStats(char statschar, User* user, string_list &results)
                {
                        results.push_back("249 "+user->nick+" :Users: "+ConvToStr(ServerInstance->Users->GetUsers().size()));
                        results.push_back("249 "+user->nick+" :Channels: "+ConvToStr(ServerInstance->GetChans().size()));
-                       results.push_back("249 "+user->nick+" :Commands: "+ConvToStr(ServerInstance->Parser->GetCommands().size()));
+                       results.push_back("249 "+user->nick+" :Commands: "+ConvToStr(ServerInstance->Parser.GetCommands().size()));
 
                        float kbitpersec_in, kbitpersec_out, kbitpersec_total;
                        char kbitpersec_in_s[30], kbitpersec_out_s[30], kbitpersec_total_s[30];
index 898b4f455e1d03659cb364ec73e05efd3fdda3aa..cb428c32a42afae8f4627452859e6e8d6efbd05f 100644 (file)
@@ -131,7 +131,6 @@ void InspIRCd::Cleanup()
        DeleteZero(this->Users);
        DeleteZero(this->Modes);
        DeleteZero(this->XLines);
-       DeleteZero(this->Parser);
        DeleteZero(this->Modules);
        DeleteZero(this->SNO);
        DeleteZero(this->Config);
@@ -262,7 +261,6 @@ InspIRCd::InspIRCd(int argc, char** argv) :
        this->Config = 0;
        this->SNO = 0;
        this->Modules = 0;
-       this->Parser = 0;
        this->XLines = 0;
        this->Modes = 0;
        this->ConfigThread = NULL;
@@ -286,7 +284,6 @@ InspIRCd::InspIRCd(int argc, char** argv) :
        this->SNO = new SnomaskManager;
        this->Modules = new ModuleManager();
        dynamic_reference_base::reset_all();
-       this->Parser = new CommandParser;
        this->XLines = new XLineManager;
 
        this->Config->cmdline.argv = argv;
index 78b00e95ea61cc79e56c9b5bb7151a1fd5486f9b..16459eeb4ecb3f9860ff23405f97845f3fe6125f 100644 (file)
@@ -593,7 +593,7 @@ void ModuleManager::AddService(ServiceProvider& item)
        switch (item.service)
        {
                case SERVICE_COMMAND:
-                       if (!ServerInstance->Parser->AddCommand(static_cast<Command*>(&item)))
+                       if (!ServerInstance->Parser.AddCommand(static_cast<Command*>(&item)))
                                throw ModuleException("Command "+std::string(item.name)+" already exists.");
                        return;
                case SERVICE_MODE:
index a7bf8ceeebd8532e3b60b3ad81f72ecba1b41ac9..77d86cb3167ba5de06b8ed1a37197c8b88e3718b 100644 (file)
@@ -42,7 +42,7 @@ class ModuleAbbreviation : public Module
                size_t clen = command.length() - 1;
                std::string foundcommand, matchlist;
                bool foundmatch = false;
-               const CommandParser::CommandMap& commands = ServerInstance->Parser->GetCommands();
+               const CommandParser::CommandMap& commands = ServerInstance->Parser.GetCommands();
                for (CommandParser::CommandMap::const_iterator n = commands.begin(); n != commands.end(); ++n)
                {
                        if (!command.compare(0, clen, n->first, 0, clen))
index 76476109908b55065ec980436766a2373d6d3dc7..2d4bdded30fa70515972fb827bd0034ba1a41440 100644 (file)
@@ -344,7 +344,7 @@ class ModuleAlias : public Module
                {
                        pars.push_back(token);
                }
-               ServerInstance->Parser->CallHandler(command, pars, user);
+               ServerInstance->Parser.CallHandler(command, pars, user);
        }
 
        void Prioritize()
index 9bfa3971f225225ecdf1e73048cb11fcd3b8a585..36238f846e41ef109d1864215dfa989a4326b2bd 100644 (file)
@@ -41,7 +41,7 @@ class LDAPOperBase : public LDAPInterface
                if (!user)
                        return;
 
-               Command* oper_command = ServerInstance->Parser->GetHandler("OPER");
+               Command* oper_command = ServerInstance->Parser.GetHandler("OPER");
                if (!oper_command)
                        return;
 
index d015d5ead0427a6f3b5f880a9d43c76b486629aa..68f50bf6d046e47ebbc77067321b54b225afdd75 100644 (file)
@@ -49,7 +49,7 @@ class ModuleOperLog : public Module
 
                if ((user->IsOper()) && (user->HasPermission(command)))
                {
-                       Command* thiscommand = ServerInstance->Parser->GetHandler(command);
+                       Command* thiscommand = ServerInstance->Parser.GetHandler(command);
                        if ((thiscommand) && (thiscommand->flags_needed == 'o'))
                        {
                                std::string msg = "[" + user->GetFullRealHost() + "] " + command + " " + irc::stringjoiner(parameters);
index 8cdd343b1409765888d30b353e3f0ece7c74f86e..3050dba0b5343444dee22d5803601539960783f6 100644 (file)
@@ -96,7 +96,7 @@ class ModulePassForward : public Module
 
                tmp.clear();
                FormatStr(tmp,forwardcmd, user);
-               ServerInstance->Parser->ProcessBuffer(tmp,user);
+               ServerInstance->Parser.ProcessBuffer(tmp,user);
        }
 };
 
index c42877eef2fab9943a14d30d0b9dd1312fc1f9cd..132a2226765ece96cd62c7edf3dc44381310c1cb 100644 (file)
@@ -104,7 +104,7 @@ class ModuleShowFile : public Module
                FileReader reader(file);
 
                CommandShowFile* sfcmd;
-               Command* handler = ServerInstance->Parser->GetHandler(cmdname);
+               Command* handler = ServerInstance->Parser.GetHandler(cmdname);
                if (handler)
                {
                        // Command exists, check if it is ours
index 3a213c6e7c2e0b2c43d8526a75f3137d04736767..5e157420ea500fb7593fb55351d6e9159f0bad7d 100644 (file)
@@ -85,7 +85,7 @@ class CommandSVSSilence : public Command
 
                if (IS_LOCAL(u))
                {
-                       ServerInstance->Parser->CallHandler("SILENCE", std::vector<std::string>(parameters.begin() + 1, parameters.end()), u);
+                       ServerInstance->Parser.CallHandler("SILENCE", std::vector<std::string>(parameters.begin() + 1, parameters.end()), u);
                }
 
                return CMD_SUCCESS;
index 566f15da88d0298ee49c1b2bceda14b7ea7603ee..95f8f4e4a7da0ea4b7f7f6da73cfc7efda3185c7 100644 (file)
@@ -28,7 +28,7 @@ CmdResult CommandEncap::Handle(User* user, std::vector<std::string>& params)
        {
                parameterlist plist(params.begin() + 2, params.end());
                Command* cmd = NULL;
-               ServerInstance->Parser->CallHandler(params[1], plist, user, &cmd);
+               ServerInstance->Parser.CallHandler(params[1], plist, user, &cmd);
                // Discard return value, ENCAP shall succeed even if the command does not exist
 
                if ((cmd) && (cmd->force_manual_route))
index 1b020701be8ff0a35d3f98b325126ddaaaf58a63..06af4d0fd66805e74b5d3b48df54e3d6c1682442 100644 (file)
@@ -47,7 +47,7 @@ CmdResult CommandIdle::HandleRemote(RemoteUser* issuer, std::vector<std::string>
 
        if (params.size() >= 2)
        {
-               ServerInstance->Parser->CallHandler("WHOIS", params, issuer);
+               ServerInstance->Parser.CallHandler("WHOIS", params, issuer);
        }
        else
        {
index 8d939d22a20eefb040b4a3d37d79a065d72fde8f..882596b819c71eafad1a7272d104300f1a70361e 100644 (file)
@@ -304,7 +304,7 @@ void TreeSocket::ProcessConnectedLine(std::string& prefix, std::string& command,
        if (!scmd)
        {
                // Not a special server-to-server command
-               cmd = ServerInstance->Parser->GetHandler(command);
+               cmd = ServerInstance->Parser.GetHandler(command);
                if (!cmd)
                {
                        if (command == "ERROR")
index fb5b65e566e82a91ce3809c82246255814834b33..3d5551eb0d1fb453195da155a2430d0bfff00e14 100644 (file)
@@ -61,7 +61,7 @@ class OpMeQuery : public SQLQuery
                if (!user)
                        return;
 
-               Command* oper_command = ServerInstance->Parser->GetHandler("OPER");
+               Command* oper_command = ServerInstance->Parser.GetHandler("OPER");
 
                if (oper_command)
                {
index 57ca18a8fc22e84e9029cf4719684ed9caf414fe..94292e4bee930135a61c2454ac465b378ad800f6 100644 (file)
@@ -119,7 +119,7 @@ class CommandSVSWatch : public Command
 
                if (IS_LOCAL(u))
                {
-                       ServerInstance->Parser->CallHandler("WATCH", parameters, u);
+                       ServerInstance->Parser.CallHandler("WATCH", parameters, u);
                }
 
                return CMD_SUCCESS;
index 9a6c573f3bb67993881926f563b57966b8ff41e1..39e1ec79640b95b7e52bbb72a76a7e592fd2ff21 100644 (file)
@@ -288,7 +288,7 @@ eol_found:
                user->bytes_in += qpos;
                user->cmds_in++;
 
-               ServerInstance->Parser->ProcessBuffer(line, user);
+               ServerInstance->Parser.ProcessBuffer(line, user);
                if (user->quitting)
                        return;
        }
@@ -575,13 +575,13 @@ void LocalUser::FullConnect()
        std::vector<std::string> parameters;
        FIRST_MOD_RESULT(OnPreCommand, MOD_RESULT, (command, parameters, this, true, command));
        if (!MOD_RESULT)
-               ServerInstance->Parser->CallHandler(command, parameters, this);
+               ServerInstance->Parser.CallHandler(command, parameters, this);
 
        MOD_RESULT = MOD_RES_PASSTHRU;
        command = "MOTD";
        FIRST_MOD_RESULT(OnPreCommand, MOD_RESULT, (command, parameters, this, true, command));
        if (!MOD_RESULT)
-               ServerInstance->Parser->CallHandler(command, parameters, this);
+               ServerInstance->Parser.CallHandler(command, parameters, this);
 
        if (ServerInstance->Config->RawLog)
                WriteServ("PRIVMSG %s :*** Raw I/O logging is enabled on this server. All messages, passwords, and commands are being recorded.", nick.c_str());