From 12fc9198eeaea7666ad65cf64fd204d038a54e4e Mon Sep 17 00:00:00 2001 From: w00t Date: Mon, 27 Aug 2007 23:14:18 +0000 Subject: Tidy this up a bit (it looked weird :P) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7926 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/command_parse.cpp | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) (limited to 'src/command_parse.cpp') 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; -- cgit v1.2.3