diff options
-rw-r--r-- | data/example.conf | 8 | ||||
-rw-r--r-- | modules/commands/help.cpp | 16 |
2 files changed, 15 insertions, 9 deletions
diff --git a/data/example.conf b/data/example.conf index 48ff039c3..261e15898 100644 --- a/data/example.conf +++ b/data/example.conf @@ -512,11 +512,17 @@ options retrywait = 60s /* - * If set, Services will hide commands that users don't have the privileges to execute + * If set, Services will hide commands that users don't have the privilege to execute * from HELP output. */ hideprivilegedcommands = yes + /* + * If set, Services will hide commands that users can't execute because they are not + * logged in from HELP output. + */ + hideregisteredcommands = yes + /* The regex engine to use, as provided by the regex modules. * Leave commented to disable regex matching. * diff --git a/modules/commands/help.cpp b/modules/commands/help.cpp index ac8c98b09..8d9cce46d 100644 --- a/modules/commands/help.cpp +++ b/modules/commands/help.cpp @@ -44,7 +44,8 @@ class CommandHelp : public Command Anope::string source_command = source.command; const BotInfo *bi = source.service; const CommandInfo::map &map = source.c ? Config->Fantasy : bi->commands; - bool hide_privileged_commands = Config->GetBlock("options")->Get<bool>("hideprivilegedcommands"); + bool hide_privileged_commands = Config->GetBlock("options")->Get<bool>("hideprivilegedcommands"), + hide_registered_commands = Config->GetBlock("options")->Get<bool>("hideregisteredcommands"); if (params.empty() || params[0].equals_ci("ALL")) { @@ -72,11 +73,11 @@ class CommandHelp : public Command ServiceReference<Command> 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()) + + if (hide_registered_commands && !c->AllowUnregistered() && !source.GetAccount()) continue; - else if (!info.permission.empty() && !source.HasCommand(info.permission)) + + if (hide_privileged_commands && !info.permission.empty() && !source.HasCommand(info.permission)) continue; if (!info.group.empty() && !all) @@ -145,9 +146,8 @@ class CommandHelp : public Command ServiceReference<Command> c("Command", info.name); if (!c) continue; - else if (!hide_privileged_commands) - ; // Always show with hide_privileged_commands disabled - else if (!info.permission.empty() && !source.HasCommand(info.permission)) + + if (hide_privileged_commands && !info.permission.empty() && !source.HasCommand(info.permission)) continue; // Allow unregistered users to see help for commands that they explicitly request help for |