From 1b4aec7bda2ccd45dbf1c18ae6585dfe185bdf48 Mon Sep 17 00:00:00 2001 From: Adam- Date: Sun, 30 Aug 2009 20:46:07 +0000 Subject: [PATCH] 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 --- lang/cat.l | 9 +++++++++ lang/de.l | 9 +++++++++ lang/en_us.l | 9 +++++++++ lang/es.l | 9 +++++++++ lang/fr.l | 9 +++++++++ lang/gr.l | 9 +++++++++ lang/hun.l | 9 +++++++++ lang/it.l | 9 +++++++++ lang/nl.l | 9 +++++++++ lang/pl.l | 10 ++++++++++ lang/pt.l | 9 +++++++++ lang/ru.l | 9 +++++++++ lang/tr.l | 9 +++++++++ src/commands.c | 18 ++++++++++++++++++ 14 files changed, 136 insertions(+) diff --git a/lang/cat.l b/lang/cat.l index 42c8d7bc3..03f606ed8 100644 --- a/lang/cat.l +++ b/lang/cat.l @@ -135,6 +135,15 @@ STRFTIME_MONTHS_LONG COMMA_SPACE , +# Command help replies +COMMAND_REQUIRES_PERM + Access to this command requires the permission %s to be present in your opertype. +COMMAND_IDENTIFY_REQUIRED + You need to be identified to use this command. +COMMAND_CANNOT_USE + You cannot use this command. +COMMAND_CAN_USE + You can use this command. # Various error messages. USER_RECORD_NOT_FOUND diff --git a/lang/de.l b/lang/de.l index 239fadf5e..30e9c8a1b 100644 --- a/lang/de.l +++ b/lang/de.l @@ -152,6 +152,15 @@ STRFTIME_MONTHS_LONG COMMA_SPACE , +# Command help replies +COMMAND_REQUIRES_PERM + Access to this command requires the permission %s to be present in your opertype. +COMMAND_IDENTIFY_REQUIRED + You need to be identified to use this command. +COMMAND_CANNOT_USE + You cannot use this command. +COMMAND_CAN_USE + You can use this command. # Various error messages. USER_RECORD_NOT_FOUND diff --git a/lang/en_us.l b/lang/en_us.l index 5af737e02..b2d3201a0 100644 --- a/lang/en_us.l +++ b/lang/en_us.l @@ -134,6 +134,15 @@ STRFTIME_MONTHS_LONG COMMA_SPACE , +# Command help replies +COMMAND_REQUIRES_PERM + Access to this command requires the permission %s to be present in your opertype. +COMMAND_IDENTIFY_REQUIRED + You need to be identified to use this command. +COMMAND_CANNOT_USE + You cannot use this command. +COMMAND_CAN_USE + You can use this command. # Various error messages. USER_RECORD_NOT_FOUND diff --git a/lang/es.l b/lang/es.l index 4ae2e62ee..c3276e18e 100644 --- a/lang/es.l +++ b/lang/es.l @@ -134,6 +134,15 @@ STRFTIME_MONTHS_LONG COMMA_SPACE , +# Command help replies +COMMAND_REQUIRES_PERM + Access to this command requires the permission %s to be present in your opertype. +COMMAND_IDENTIFY_REQUIRED + You need to be identified to use this command. +COMMAND_CANNOT_USE + You cannot use this command. +COMMAND_CAN_USE + You can use this command. # Various error messages. USER_RECORD_NOT_FOUND diff --git a/lang/fr.l b/lang/fr.l index f34c4fb6c..e7d993d22 100644 --- a/lang/fr.l +++ b/lang/fr.l @@ -140,6 +140,15 @@ STRFTIME_MONTHS_LONG COMMA_SPACE , +# Command help replies +COMMAND_REQUIRES_PERM + Access to this command requires the permission %s to be present in your opertype. +COMMAND_IDENTIFY_REQUIRED + You need to be identified to use this command. +COMMAND_CANNOT_USE + You cannot use this command. +COMMAND_CAN_USE + You can use this command. # Various error messages. USER_RECORD_NOT_FOUND diff --git a/lang/gr.l b/lang/gr.l index e2bdc5421..13d97ea2f 100644 --- a/lang/gr.l +++ b/lang/gr.l @@ -134,6 +134,15 @@ STRFTIME_MONTHS_LONG COMMA_SPACE , +# Command help replies +COMMAND_REQUIRES_PERM + Access to this command requires the permission %s to be present in your opertype. +COMMAND_IDENTIFY_REQUIRED + You need to be identified to use this command. +COMMAND_CANNOT_USE + You cannot use this command. +COMMAND_CAN_USE + You can use this command. # Various error messages. USER_RECORD_NOT_FOUND diff --git a/lang/hun.l b/lang/hun.l index 6e01c1668..e5a50bda3 100644 --- a/lang/hun.l +++ b/lang/hun.l @@ -142,6 +142,15 @@ STRFTIME_MONTHS_LONG COMMA_SPACE , +# Command help replies +COMMAND_REQUIRES_PERM + Access to this command requires the permission %s to be present in your opertype. +COMMAND_IDENTIFY_REQUIRED + You need to be identified to use this command. +COMMAND_CANNOT_USE + You cannot use this command. +COMMAND_CAN_USE + You can use this command. # Különböző hiba üzenetek. USER_RECORD_NOT_FOUND diff --git a/lang/it.l b/lang/it.l index 4e0e6f1be..9e9ee61ee 100644 --- a/lang/it.l +++ b/lang/it.l @@ -136,6 +136,15 @@ STRFTIME_MONTHS_LONG COMMA_SPACE , +# Command help replies +COMMAND_REQUIRES_PERM + Access to this command requires the permission %s to be present in your opertype. +COMMAND_IDENTIFY_REQUIRED + You need to be identified to use this command. +COMMAND_CANNOT_USE + You cannot use this command. +COMMAND_CAN_USE + You can use this command. # Various error messages. USER_RECORD_NOT_FOUND diff --git a/lang/nl.l b/lang/nl.l index 90a7bd44f..e4e26b082 100644 --- a/lang/nl.l +++ b/lang/nl.l @@ -136,6 +136,15 @@ STRFTIME_MONTHS_LONG COMMA_SPACE , +# Command help replies +COMMAND_REQUIRES_PERM + Access to this command requires the permission %s to be present in your opertype. +COMMAND_IDENTIFY_REQUIRED + You need to be identified to use this command. +COMMAND_CANNOT_USE + You cannot use this command. +COMMAND_CAN_USE + You can use this command. # Various error messages. USER_RECORD_NOT_FOUND diff --git a/lang/pl.l b/lang/pl.l index 2da215963..e65fd4314 100644 --- a/lang/pl.l +++ b/lang/pl.l @@ -146,6 +146,16 @@ STRFTIME_MONTHS_LONG COMMA_SPACE , +# Command help replies +COMMAND_REQUIRES_PERM + Access to this command requires the permission %s to be present in your opertype. +COMMAND_IDENTIFY_REQUIRED + You need to be identified to use this command. +COMMAND_CANNOT_USE + You cannot use this command. +COMMAND_CAN_USE + You can use this command. + # Various error messages. USER_RECORD_NOT_FOUND Błąd wewnętrzny - nie mogę obsłużyć żądania. diff --git a/lang/pt.l b/lang/pt.l index 2a6095472..42a477505 100644 --- a/lang/pt.l +++ b/lang/pt.l @@ -144,6 +144,15 @@ STRFTIME_MONTHS_LONG COMMA_SPACE , +# Command help replies +COMMAND_REQUIRES_PERM + Access to this command requires the permission %s to be present in your opertype. +COMMAND_IDENTIFY_REQUIRED + You need to be identified to use this command. +COMMAND_CANNOT_USE + You cannot use this command. +COMMAND_CAN_USE + You can use this command. # Various error messages. USER_RECORD_NOT_FOUND diff --git a/lang/ru.l b/lang/ru.l index 33405f1b1..9adb2c484 100644 --- a/lang/ru.l +++ b/lang/ru.l @@ -140,6 +140,15 @@ STRFTIME_MONTHS_LONG COMMA_SPACE , +# Command help replies +COMMAND_REQUIRES_PERM + Access to this command requires the permission %s to be present in your opertype. +COMMAND_IDENTIFY_REQUIRED + You need to be identified to use this command. +COMMAND_CANNOT_USE + You cannot use this command. +COMMAND_CAN_USE + You can use this command. # Various error messages. USER_RECORD_NOT_FOUND diff --git a/lang/tr.l b/lang/tr.l index 76fdce601..3483c7e64 100644 --- a/lang/tr.l +++ b/lang/tr.l @@ -138,6 +138,15 @@ STRFTIME_MONTHS_LONG COMMA_SPACE , +# Command help replies +COMMAND_REQUIRES_PERM + Access to this command requires the permission %s to be present in your opertype. +COMMAND_IDENTIFY_REQUIRED + You need to be identified to use this command. +COMMAND_CANNOT_USE + You cannot use this command. +COMMAND_CAN_USE + You can use this command. # Various error messages. USER_RECORD_NOT_FOUND 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); + } } /*************************************************************************/