Privilege to use a command is now handled by the priv arg of cmd_add.
This commit is contained in:
1 parent
d24452d0dd
commit
3b1aba6195
3 files changed
+24
-29
No files matched your search
@@ -3,6 +3,8 @@ Auto IRC Bot 3.0: Change Log
|
|||||||
|
|
||||||
3.0 Indev
|
3.0 Indev
|
||||||
==================================================================
|
==================================================================
|
||||||
|
* Privilege to use a command is now handled by the priv arg of
|
||||||
|
cmd_add.
|
||||||
* HELP now only displays help if the user has the appropriate
|
* HELP now only displays help if the user has the appropriate
|
||||||
privileges.
|
privileges.
|
||||||
* Updated Core::IRC and all modules to obey the updated API.
|
* Updated Core::IRC and all modules to obey the updated API.
|
||||||
|
|||||||
@@ -34,11 +34,6 @@ sub cmd_modload
|
|||||||
my (%data) = @_;
|
my (%data) = @_;
|
||||||
my @argv = @{ $data{args} };
|
my @argv = @{ $data{args} };
|
||||||
|
|
||||||
# Check for the appropriate privilege.
|
|
||||||
if (!has_priv(match_user(%data), "cfunc.modules")) {
|
|
||||||
notice($data{svr}, $data{nick}, trans("Permission denied").".");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
# Check for the needed parameters.
|
# Check for the needed parameters.
|
||||||
if (!defined $argv[0]) {
|
if (!defined $argv[0]) {
|
||||||
notice($data{svr}, $data{nick}, trans("Not enough parameters").".");
|
notice($data{svr}, $data{nick}, trans("Not enough parameters").".");
|
||||||
@@ -78,11 +73,6 @@ sub cmd_modunload
|
|||||||
my (%data) = @_;
|
my (%data) = @_;
|
||||||
my @argv = @{ $data{args} };
|
my @argv = @{ $data{args} };
|
||||||
|
|
||||||
# Check for the appropriate privilege.
|
|
||||||
if (!has_priv(match_user(%data), "cfunc.modules")) {
|
|
||||||
notice($data{svr}, $data{nick}, trans("Permission denied").".");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
# Check for the needed parameters.
|
# Check for the needed parameters.
|
||||||
if (!defined $argv[0]) {
|
if (!defined $argv[0]) {
|
||||||
notice($data{svr}, $data{nick}, trans("Not enough parameters").".");
|
notice($data{svr}, $data{nick}, trans("Not enough parameters").".");
|
||||||
@@ -122,11 +112,6 @@ sub cmd_modreload
|
|||||||
my (%data) = @_;
|
my (%data) = @_;
|
||||||
my @argv = @{ $data{args} };
|
my @argv = @{ $data{args} };
|
||||||
|
|
||||||
# Check for the appropriate privilege.
|
|
||||||
if (!has_priv(match_user(%data), "cfunc.modules")) {
|
|
||||||
notice($data{svr}, $data{nick}, trans("Permission denied").".");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
# Check for the needed parameters.
|
# Check for the needed parameters.
|
||||||
if (!defined $argv[0]) {
|
if (!defined $argv[0]) {
|
||||||
notice($data{svr}, $data{nick}, trans("Not enough parameters").".");
|
notice($data{svr}, $data{nick}, trans("Not enough parameters").".");
|
||||||
@@ -167,12 +152,6 @@ sub cmd_shutdown
|
|||||||
{
|
{
|
||||||
my (%data) = @_;
|
my (%data) = @_;
|
||||||
|
|
||||||
# Check for the appropriate privilege.
|
|
||||||
if (!has_priv(match_user(%data), "cmd.shutdown")) {
|
|
||||||
notice($data{svr}, $data{nick}, trans("Permission denied").".");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Goodbye world!
|
# Goodbye world!
|
||||||
notice($data{svr}, $data{nick}, "Shutting down.");
|
notice($data{svr}, $data{nick}, "Shutting down.");
|
||||||
dbug "Got SHUTDOWN from ".$data{nick}."!".$data{user}."@".$data{host}."/".$data{svr}."! Shutting down. . .";
|
dbug "Got SHUTDOWN from ".$data{nick}."!".$data{user}."@".$data{host}."/".$data{svr}."! Shutting down. . .";
|
||||||
@@ -195,12 +174,6 @@ sub cmd_restart
|
|||||||
{
|
{
|
||||||
my (%data) = @_;
|
my (%data) = @_;
|
||||||
|
|
||||||
# Check for the appropriate privilege.
|
|
||||||
if (!has_priv(match_user(%data), "cmd.restart")) {
|
|
||||||
notice($data{svr}, $data{nick}, trans("Permission denied").".");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Goodbye world!
|
# Goodbye world!
|
||||||
notice($data{svr}, $data{nick}, "Restarting.");
|
notice($data{svr}, $data{nick}, "Restarting.");
|
||||||
dbug "Got RESTART from ".$data{nick}."!".$data{user}."@".$data{host}."/".$data{svr}."! Restarting. . .";
|
dbug "Got RESTART from ".$data{nick}."!".$data{user}."@".$data{host}."/".$data{svr}."! Restarting. . .";
|
||||||
|
|||||||
+22
-2
@@ -465,7 +465,17 @@ sub privmsg
|
|||||||
$cmd = uc(substr($ex[3], 1));
|
$cmd = uc(substr($ex[3], 1));
|
||||||
if (defined $API::Std::CMDS{$cmd}) {
|
if (defined $API::Std::CMDS{$cmd}) {
|
||||||
if ($API::Std::CMDS{$cmd}{lvl} == 1 or $API::Std::CMDS{$cmd}{lvl} == 2) {
|
if ($API::Std::CMDS{$cmd}{lvl} == 1 or $API::Std::CMDS{$cmd}{lvl} == 2) {
|
||||||
&{ $API::Std::CMDS{$cmd}{sub} }(%data);
|
if ($API::Std::CMDS{$cmd}{priv}) {
|
||||||
|
if (API::Std::has_priv(API::Std::match_user(%data), $API::Std::CMDS{$cmd}{priv})) {
|
||||||
|
&{ $API::Std::CMDS{$cmd}{sub} }(%data);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
API::IRC::notice($data{svr}, $data{nick}, API::Std::trans("Permission denied").".");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
&{ $API::Std::CMDS{$cmd}{sub} }(%data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -480,7 +490,17 @@ sub privmsg
|
|||||||
$cmd = uc(substr($ex[3], 2));
|
$cmd = uc(substr($ex[3], 2));
|
||||||
if (defined $API::Std::CMDS{$cmd}) {
|
if (defined $API::Std::CMDS{$cmd}) {
|
||||||
if ($API::Std::CMDS{$cmd}{lvl} == 0 or $API::Std::CMDS{$cmd}{lvl} == 2) {
|
if ($API::Std::CMDS{$cmd}{lvl} == 0 or $API::Std::CMDS{$cmd}{lvl} == 2) {
|
||||||
&{ $API::Std::CMDS{$cmd}{sub} }(%data) if $rprefix eq $cprefix;
|
if ($API::Std::CMDS{$cmd}{priv}) {
|
||||||
|
if (API::Std::has_priv(API::Std::match_user(%data), $API::Std::CMDS{$cmd}{priv})) {
|
||||||
|
&{ $API::Std::CMDS{$cmd}{sub} }(%data) if $rprefix eq $cprefix;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
API::IRC::notice($data{svr}, $data{nick}, API::Std::trans("Permission denied").".");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
&{ $API::Std::CMDS{$cmd}{sub} }(%data) if $rprefix eq $cprefix;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user