HELP now uses the new priv argument for displaying help only if the user has the appropriate privilege.
This commit is contained in:
1 parent
62250648b7
commit
61965c1cec
2 files changed
+27
-2
No files matched your search
@@ -3,6 +3,8 @@ Auto IRC Bot 3.0: Change Log
|
||||
|
||||
3.0 Indev
|
||||
==================================================================
|
||||
* HELP now only displays help if the user has the appropriate
|
||||
privileges.
|
||||
* Updated Core::IRC and all modules to obey the updated API.
|
||||
* Deleted shelp from cmd_add, replaced with privilege. Renamed
|
||||
fhelp to help.
|
||||
|
||||
+25
-2
@@ -239,12 +239,26 @@ sub cmd_help
|
||||
foreach (sort keys %API::Std::CMDS) {
|
||||
if (defined $data{chan}) {
|
||||
if ($API::Std::CMDS{$_}{lvl} == 0 or $API::Std::CMDS{$_}{lvl} == 2) {
|
||||
$cmdlist .= ", \002".uc($_)."\002";
|
||||
if ($API::Std::CMDS{$_}{priv}) {
|
||||
if (has_priv(match_user(%data), $API::Std::CMDS{$_}{priv})) {
|
||||
$cmdlist .= ", \002".uc($_)."\002";
|
||||
}
|
||||
}
|
||||
else {
|
||||
$cmdlist .= ", \002".uc($_)."\002";
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ($API::Std::CMDS{$_}{lvl} == 1 or $API::Std::CMDS{$_}{lvl} == 2) {
|
||||
$cmdlist .= ", \002".uc($_)."\002";
|
||||
if ($API::Std::CMDS{$_}{priv}) {
|
||||
if (has_priv(match_user(%data), $API::Std::CMDS{$_}{priv})) {
|
||||
$cmdlist .= ", \002".uc($_)."\002";
|
||||
}
|
||||
}
|
||||
else {
|
||||
$cmdlist .= ", \002".uc($_)."\002";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -258,6 +272,15 @@ sub cmd_help
|
||||
|
||||
if (defined $API::Std::CMDS{$rcm}{help}) {
|
||||
# If there is help for this command.
|
||||
|
||||
# Check for necessary privileges.
|
||||
if ($API::Std::CMDS{$rcm}{priv}) {
|
||||
if (!has_priv(match_user(%data), $API::Std::CMDS{$rcm}{priv})) {
|
||||
notice($data{svr}, $data{nick}, trans("Access denied").".");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ($API::Std::CMDS{$rcm}{help}) {
|
||||
# If there is valid help for this command.
|
||||
|
||||
|
||||
Reference in new issue
Block a user