summaryrefslogtreecommitdiff
path: root/src/commands.c
diff options
context:
space:
mode:
authorAdam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864>2009-08-30 20:46:07 +0000
committerAdam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864>2009-08-30 20:46:07 +0000
commit1b4aec7bda2ccd45dbf1c18ae6585dfe185bdf48 (patch)
treea6fe3c7cf128fe4a817155c41525b8f91261852e /src/commands.c
parent586c8a70f48a34717e4e70f0ea8f6c434481ac26 (diff)
Add messages at the bottom of HELP telling you if you can/cant use the command and why, and what permission is required if there is one
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2487 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src/commands.c')
-rw-r--r--src/commands.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/commands.c b/src/commands.c
index a564b644e..a3ba87e1c 100644
--- a/src/commands.c
+++ b/src/commands.c
@@ -199,6 +199,24 @@ void mod_help_cmd(char *service, User * u, CommandHash * cmdTable[], const char
if (!c || !c->OnHelp(u, subcommand))
notice_lang(service, u, NO_HELP_AVAILABLE, cmd);
+ else
+ {
+ u->SendMessage(service, " ");
+
+ /* Inform the user what permission is required to use the command */
+ if (!c->permission.empty())
+ notice_lang(service, u, COMMAND_REQUIRES_PERM, c->permission.c_str());
+
+ /* User isn't identified and needs to be to use this command */
+ if (!c->HasFlag(CFLAG_ALLOW_UNREGISTERED) && !nick_identified(u))
+ notice_lang(service, u, COMMAND_IDENTIFY_REQUIRED);
+ /* User doesn't have the proper permission to use this command */
+ else if (!c->permission.empty() && (!u->nc || (!u->nc->HasCommand(c->permission))))
+ notice_lang(service, u, COMMAND_CANNOT_USE);
+ /* User can use this command */
+ else
+ notice_lang(service, u, COMMAND_CAN_USE);
+ }
}
/*************************************************************************/