summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-12-16 10:22:16 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-12-16 10:22:16 +0000
commitf7be9d31e0004f11720da9db858710ff9f3eab5e (patch)
treee281877504771104c1d677575ae7accd818e5add /src
parent3f0f99d3ef49dde2e40c624614f77d3e99335455 (diff)
Moved command_parse functions into class CommandParser
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2510 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/command_parse.cpp24
-rw-r--r--src/commands.cpp1
-rw-r--r--src/inspircd.cpp1
-rw-r--r--src/modules.cpp1
-rw-r--r--src/userprocess.cpp1
5 files changed, 16 insertions, 12 deletions
diff --git a/src/command_parse.cpp b/src/command_parse.cpp
index 2e1b19ab4..dfde943a6 100644
--- a/src/command_parse.cpp
+++ b/src/command_parse.cpp
@@ -104,7 +104,7 @@ extern command_table cmdlist;
* before the actual list as well. This code is used by many functions which
* can function as "one to list" (see the RFC) */
-int loop_call(handlerfunc fn, char **parameters, int pcnt, userrec *u, int start, int end, int joins)
+int CommandParser::LoopCall(handlerfunc fn, char **parameters, int pcnt, userrec *u, int start, int end, int joins)
{
char plist[MAXBUF];
char *param;
@@ -248,7 +248,7 @@ int loop_call(handlerfunc fn, char **parameters, int pcnt, userrec *u, int start
return 1;
}
-bool is_valid_cmd(std::string &commandname, int pcnt, userrec * user)
+bool CommandParser::IsValidCommand(std::string &commandname, int pcnt, userrec * user)
{
for (unsigned int i = 0; i < cmdlist.size(); i++)
{
@@ -282,7 +282,7 @@ bool is_valid_cmd(std::string &commandname, int pcnt, userrec * user)
// calls a handler function for a command
-void call_handler(std::string &commandname,char **parameters, int pcnt, userrec *user)
+void CommandParser::CallHandler(std::string &commandname,char **parameters, int pcnt, userrec *user)
{
for (unsigned int i = 0; i < cmdlist.size(); i++)
{
@@ -312,7 +312,7 @@ void call_handler(std::string &commandname,char **parameters, int pcnt, userrec
}
}
-int process_parameters(char **command_p,char *parameters)
+int CommandParser::ProcessParameters(char **command_p,char *parameters)
{
int j = 0;
int q = strlen(parameters);
@@ -360,7 +360,7 @@ int process_parameters(char **command_p,char *parameters)
return j; /* returns total number of items in the list */
}
-void process_command(userrec *user, char* cmd)
+void CommandParser::ProcessCommand(userrec *user, char* cmd)
{
char *parameters;
char *command;
@@ -537,20 +537,20 @@ void process_command(userrec *user, char* cmd)
user->nping = TIME + user->pingmax;
if ((items) < cmdlist[i].min_params)
{
- log(DEBUG,"process_command: not enough parameters: %s %s",user->nick,command);
+ log(DEBUG,"not enough parameters: %s %s",user->nick,command);
WriteServ(user->fd,"461 %s %s :Not enough parameters",user->nick,command);
return;
}
if ((!strchr(user->modes,cmdlist[i].flags_needed)) && (cmdlist[i].flags_needed))
{
- log(DEBUG,"process_command: permission denied: %s %s",user->nick,command);
+ log(DEBUG,"permission denied: %s %s",user->nick,command);
WriteServ(user->fd,"481 %s :Permission Denied- You do not have the required operator privilages",user->nick);
cmd_found = 1;
return;
}
if ((cmdlist[i].flags_needed) && (!user->HasPermission(xcommand)))
{
- log(DEBUG,"process_command: permission denied: %s %s",user->nick,command);
+ log(DEBUG,"permission denied: %s %s",user->nick,command);
WriteServ(user->fd,"481 %s :Permission Denied- Oper type %s does not have access to command %s",user->nick,user->oper,command);
cmd_found = 1;
return;
@@ -561,7 +561,7 @@ void process_command(userrec *user, char* cmd)
{
if ((!isnick(user->nick)) || (user->registered != 7))
{
- log(DEBUG,"process_command: not registered: %s %s",user->nick,command);
+ log(DEBUG,"not registered: %s %s",user->nick,command);
WriteServ(user->fd,"451 %s :You have not registered",command);
return;
}
@@ -625,7 +625,7 @@ void process_command(userrec *user, char* cmd)
}
}
-bool remove_commands(const char* source)
+bool CommandParser::RemoveCommands(const char* source)
{
bool go_again = true;
while (go_again)
@@ -645,7 +645,7 @@ bool remove_commands(const char* source)
return true;
}
-void process_buffer(const char* cmdbuf,userrec *user)
+void CommandParser::ProcessBuffer(const char* cmdbuf,userrec *user)
{
if (!user)
{
@@ -694,7 +694,7 @@ void process_buffer(const char* cmdbuf,userrec *user)
tidystring(cmd);
if ((user) && (cmd))
{
- process_command(user,cmd);
+ this->ProcessCommand(user,cmd);
}
}
diff --git a/src/commands.cpp b/src/commands.cpp
index 0b43ca134..4f57082ed 100644
--- a/src/commands.cpp
+++ b/src/commands.cpp
@@ -66,6 +66,7 @@ using namespace std;
extern SocketEngine* SE;
extern ServerConfig* Config;
extern InspIRCd* ServerInstance;
+extern CommandParser *Parser;
extern int MODCOUNT;
extern std::vector<Module*> modules;
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index 64a55ecd2..38f35aa39 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -92,6 +92,7 @@ userrec* fd_ref_table[65536];
serverstats* stats = new serverstats;
Server* MyServer = new Server;
ServerConfig *Config = new ServerConfig;
+CommandParser *Parser = new CommandParser;
user_hash clientlist;
chan_hash chanlist;
diff --git a/src/modules.cpp b/src/modules.cpp
index 83c0abd21..c18b84609 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -58,6 +58,7 @@ extern int MODCOUNT;
extern std::vector<Module*> modules;
extern std::vector<ircd_module*> factory;
extern std::vector<InspSocket*> module_sockets;
+extern CommandParser *Parser;
extern time_t TIME;
class Server;
diff --git a/src/userprocess.cpp b/src/userprocess.cpp
index 39ece61b0..3e89d3fae 100644
--- a/src/userprocess.cpp
+++ b/src/userprocess.cpp
@@ -73,6 +73,7 @@ extern InspIRCd* ServerInstance;
extern SocketEngine* SE;
extern serverstats* stats;
extern ServerConfig *Config;
+extern CommandParser *Parser;
extern userrec* fd_ref_table[65536];
char data[65536];