summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2014-06-13 15:45:55 +0200
committerAttila Molnar <attilamolnar@hush.com>2014-06-13 15:45:55 +0200
commit5b1ee304b5e1d71c71eec9ebf8f40758dfce5c1e (patch)
tree015557a8b0acfa33c2c849ca413c279e5e4054a8
parent97faccd6c5edd79590c1390e642bd3c34e519e0a (diff)
Change allocation of InspIRCd::Parser to be physically part of the object containing it
-rw-r--r--include/inspircd.h2
-rw-r--r--src/command_parse.cpp2
-rw-r--r--src/configreader.cpp4
-rw-r--r--src/coremods/core_info/cmd_commands.cpp2
-rw-r--r--src/coremods/core_stats.cpp4
-rw-r--r--src/inspircd.cpp3
-rw-r--r--src/modules.cpp2
-rw-r--r--src/modules/m_abbreviation.cpp2
-rw-r--r--src/modules/m_alias.cpp2
-rw-r--r--src/modules/m_ldapoper.cpp2
-rw-r--r--src/modules/m_operlog.cpp2
-rw-r--r--src/modules/m_passforward.cpp2
-rw-r--r--src/modules/m_showfile.cpp2
-rw-r--r--src/modules/m_silence.cpp2
-rw-r--r--src/modules/m_spanningtree/encap.cpp2
-rw-r--r--src/modules/m_spanningtree/idle.cpp2
-rw-r--r--src/modules/m_spanningtree/treesocket2.cpp2
-rw-r--r--src/modules/m_sqloper.cpp2
-rw-r--r--src/modules/m_watch.cpp2
-rw-r--r--src/users.cpp6
20 files changed, 23 insertions, 26 deletions
diff --git a/include/inspircd.h b/include/inspircd.h
index e575cd8b0..17dca94d5 100644
--- a/include/inspircd.h
+++ b/include/inspircd.h
@@ -343,7 +343,7 @@ class CoreExport InspIRCd
/** Command parser, handles client to server commands
*/
- CommandParser* Parser;
+ CommandParser Parser;
/** Thread engine, Handles threading where required
*/
diff --git a/src/command_parse.cpp b/src/command_parse.cpp
index 82bfe0962..eed549deb 100644
--- a/src/command_parse.cpp
+++ b/src/command_parse.cpp
@@ -333,7 +333,7 @@ CommandBase::~CommandBase()
Command::~Command()
{
- ServerInstance->Parser->RemoveCommand(this);
+ ServerInstance->Parser.RemoveCommand(this);
}
void CommandParser::ProcessBuffer(std::string &buffer,LocalUser *user)
diff --git a/src/configreader.cpp b/src/configreader.cpp
index 945600e6c..0ec53c482 100644
--- a/src/configreader.cpp
+++ b/src/configreader.cpp
@@ -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);
}
diff --git a/src/coremods/core_info/cmd_commands.cpp b/src/coremods/core_info/cmd_commands.cpp
index 8b255a928..3a892c5c4 100644
--- a/src/coremods/core_info/cmd_commands.cpp
+++ b/src/coremods/core_info/cmd_commands.cpp
@@ -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)
diff --git a/src/coremods/core_stats.cpp b/src/coremods/core_stats.cpp
index 1e90ed2bf..1ae2e168e 100644
--- a/src/coremods/core_stats.cpp
+++ b/src/coremods/core_stats.cpp
@@ -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];
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index 898b4f455..cb428c32a 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -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;
diff --git a/src/modules.cpp b/src/modules.cpp
index 78b00e95e..16459eeb4 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -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:
diff --git a/src/modules/m_abbreviation.cpp b/src/modules/m_abbreviation.cpp
index a7bf8ceee..77d86cb31 100644
--- a/src/modules/m_abbreviation.cpp
+++ b/src/modules/m_abbreviation.cpp
@@ -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))
diff --git a/src/modules/m_alias.cpp b/src/modules/m_alias.cpp
index 764761099..2d4bdded3 100644
--- a/src/modules/m_alias.cpp
+++ b/src/modules/m_alias.cpp
@@ -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()
diff --git a/src/modules/m_ldapoper.cpp b/src/modules/m_ldapoper.cpp
index 9bfa3971f..36238f846 100644
--- a/src/modules/m_ldapoper.cpp
+++ b/src/modules/m_ldapoper.cpp
@@ -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;
diff --git a/src/modules/m_operlog.cpp b/src/modules/m_operlog.cpp
index d015d5ead..68f50bf6d 100644
--- a/src/modules/m_operlog.cpp
+++ b/src/modules/m_operlog.cpp
@@ -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);
diff --git a/src/modules/m_passforward.cpp b/src/modules/m_passforward.cpp
index 8cdd343b1..3050dba0b 100644
--- a/src/modules/m_passforward.cpp
+++ b/src/modules/m_passforward.cpp
@@ -96,7 +96,7 @@ class ModulePassForward : public Module
tmp.clear();
FormatStr(tmp,forwardcmd, user);
- ServerInstance->Parser->ProcessBuffer(tmp,user);
+ ServerInstance->Parser.ProcessBuffer(tmp,user);
}
};
diff --git a/src/modules/m_showfile.cpp b/src/modules/m_showfile.cpp
index c42877eef..132a22267 100644
--- a/src/modules/m_showfile.cpp
+++ b/src/modules/m_showfile.cpp
@@ -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
diff --git a/src/modules/m_silence.cpp b/src/modules/m_silence.cpp
index 3a213c6e7..5e157420e 100644
--- a/src/modules/m_silence.cpp
+++ b/src/modules/m_silence.cpp
@@ -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;
diff --git a/src/modules/m_spanningtree/encap.cpp b/src/modules/m_spanningtree/encap.cpp
index 566f15da8..95f8f4e4a 100644
--- a/src/modules/m_spanningtree/encap.cpp
+++ b/src/modules/m_spanningtree/encap.cpp
@@ -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))
diff --git a/src/modules/m_spanningtree/idle.cpp b/src/modules/m_spanningtree/idle.cpp
index 1b020701b..06af4d0fd 100644
--- a/src/modules/m_spanningtree/idle.cpp
+++ b/src/modules/m_spanningtree/idle.cpp
@@ -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
{
diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp
index 8d939d22a..882596b81 100644
--- a/src/modules/m_spanningtree/treesocket2.cpp
+++ b/src/modules/m_spanningtree/treesocket2.cpp
@@ -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")
diff --git a/src/modules/m_sqloper.cpp b/src/modules/m_sqloper.cpp
index fb5b65e56..3d5551eb0 100644
--- a/src/modules/m_sqloper.cpp
+++ b/src/modules/m_sqloper.cpp
@@ -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)
{
diff --git a/src/modules/m_watch.cpp b/src/modules/m_watch.cpp
index 57ca18a8f..94292e4be 100644
--- a/src/modules/m_watch.cpp
+++ b/src/modules/m_watch.cpp
@@ -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;
diff --git a/src/users.cpp b/src/users.cpp
index 9a6c573f3..39e1ec796 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -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());