Added core command MODLOAD.
This commit is contained in:
1 parent
ff06548d72
commit
76571af1d3
3 files changed
+46
-1
No files matched your search
@@ -7,6 +7,7 @@ package Core::IRC;
|
||||
use strict;
|
||||
use warnings;
|
||||
use English;
|
||||
use API::Std qw(trans has_priv match_user);
|
||||
use API::IRC qw(notice usrc);
|
||||
|
||||
sub version_reply
|
||||
@@ -22,4 +23,45 @@ sub version_reply
|
||||
}
|
||||
|
||||
|
||||
# Help hashes for CMDLOAD. Spanish, French and German needed.
|
||||
our %SHELP_CMDLOAD = (
|
||||
'en' => 'Load a module.',
|
||||
);
|
||||
our %FHELP_CMDLOAD = (
|
||||
'en' => 'Loads a module into the running Auto live.',
|
||||
);
|
||||
# CMDLOAD callback.
|
||||
sub cmd_modload
|
||||
{
|
||||
my (%data) = @_;
|
||||
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.
|
||||
if (!defined $argv[0]) {
|
||||
notice($data{svr}, $data{nick}, trans("Not enough parameters").".");
|
||||
return 0;
|
||||
}
|
||||
|
||||
my $tn = Auto::mod_load($argv[0]);
|
||||
|
||||
# Check if we were successful or not.
|
||||
if ($tn) {
|
||||
# We were!
|
||||
notice($data{svr}, $data{nick}, "Module \002".$argv[0]."\002 successfully loaded.");
|
||||
}
|
||||
else {
|
||||
# We weren't.
|
||||
notice($data{svr}, $data{nick}, "Module \002".$argv[0]."\002 failed to load.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
Reference in new issue
Block a user