diff options
-rw-r--r-- | src/command_parse.cpp | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/src/command_parse.cpp b/src/command_parse.cpp index d38a6bbca..6ba4758bd 100644 --- a/src/command_parse.cpp +++ b/src/command_parse.cpp @@ -249,20 +249,29 @@ CmdResult CommandParser::CallHandler(const std::string &commandname,const char** { if (pcnt >= n->second->min_params) { - if ((!n->second->flags_needed) || (user->IsModeSet(n->second->flags_needed))) + bool bOkay = false; + + if (IS_LOCAL(user) && n->second->flags_needed) { - if (n->second->flags_needed) - { - if (IS_REMOTE(user) || user->HasPermission(commandname)) - { - return n->second->Handle(parameters,pcnt,user); - } - } - else + /* if user is local, and flags are needed .. */ + + if (user->IsModeSet(n->second->flags_needed)) { - return n->second->Handle(parameters,pcnt,user); + /* if user has the flags, and now has the permissions, go ahead */ + if (user->HasPermission(commandname)) + bOkay = true; } } + else + { + /* remote or no flags required anyway */ + bOkay = true; + } + + if (bOkay) + { + return n->second->Handle(parameters,pcnt,user); + } } } return CMD_INVALID; |