summaryrefslogtreecommitdiff
path: root/src/command_parse.cpp
diff options
context:
space:
mode:
authorGravatar brain2006-03-02 09:57:48 +0000
committerGravatar brain2006-03-02 09:57:48 +0000
commit18c757067c0a9e5c1aa81496dca8428a0bf3635f (patch)
tree4391711a1e206ba168c5bcb69bdeee79069a8510 /src/command_parse.cpp
parentExtra checks that should prevent desyncs if you stuff up your type/class tags... (diff)
Changed definition of CallHandler and CallCommandHandler for the ability to return false on bad command.
This allows us to terminate server links that send commands we dont know (e.g. admin loads module A after linking, we dont have module A, when it sends module A's command, abort) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3414 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/command_parse.cpp')
-rw-r--r--src/command_parse.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/command_parse.cpp b/src/command_parse.cpp
index 18915b819..77fef66d7 100644
--- a/src/command_parse.cpp
+++ b/src/command_parse.cpp
@@ -288,7 +288,7 @@ bool CommandParser::IsValidCommand(std::string &commandname, int pcnt, userrec *
// calls a handler function for a command
-void CommandParser::CallHandler(std::string &commandname,char **parameters, int pcnt, userrec *user)
+bool CommandParser::CallHandler(std::string &commandname,char **parameters, int pcnt, userrec *user)
{
nspace::hash_map<std::string,command_t*>::iterator n = cmdlist.find(commandname);
@@ -300,23 +300,21 @@ void CommandParser::CallHandler(std::string &commandname,char **parameters, int
{
if (n->second->flags_needed)
{
- if ((user->HasPermission(commandname)) || (is_uline(user->server)))
+ if ((user->HasPermission(commandname)) || (!IS_LOCAL(user)))
{
n->second->Handle(parameters,pcnt,user);
- }
- else
- {
- if (!IS_LOCAL(user))
- WriteOpers("*** \2WARNING\2: Command '%s' not allowed for oper '%s', dropped.",commandname.c_str(),user->nick);
+ return true;
}
}
else
{
n->second->Handle(parameters,pcnt,user);
+ return true;
}
}
}
}
+ return false;
}
int CommandParser::ProcessParameters(char **command_p,char *parameters)