From 257b10ee912698c6378f0d02a851e3c298dc8b78 Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 2 Oct 2013 13:23:25 -0400 Subject: Hide privileged commands in ns help set and cs help set if configured --- modules/commands/ns_set.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'modules/commands/ns_set.cpp') diff --git a/modules/commands/ns_set.cpp b/modules/commands/ns_set.cpp index deaec6c62..ae7f10376 100644 --- a/modules/commands/ns_set.cpp +++ b/modules/commands/ns_set.cpp @@ -33,6 +33,7 @@ class CommandNSSet : public Command source.Reply(_("Sets various nickname options. \037option\037 can be one of:")); Anope::string this_name = source.command; + bool hide_privileged_commands = Config->GetBlock("options")->Get("hideprivilegedcommands"); for (CommandInfo::map::const_iterator it = source.service->commands.begin(), it_end = source.service->commands.end(); it != it_end; ++it) { const Anope::string &c_name = it->first; @@ -40,12 +41,18 @@ class CommandNSSet : public Command if (c_name.find_ci(this_name + " ") == 0) { - ServiceReference command("Command", info.name); - if (command) - { - source.command = c_name; - command->OnServHelp(source); - } + ServiceReference c("Command", info.name); + if (!c) + continue; + else if (!hide_privileged_commands) + ; // Always show with hide_privileged_commands disabled + else if (!c->AllowUnregistered() && !source.GetAccount()) + continue; + else if (!info.permission.empty() && !source.HasCommand(info.permission)) + continue; + + source.command = c_name; + c->OnServHelp(source); } } -- cgit