* Fixed a bug in API::Log that caused invalid months.
* Changed how command data is passed to fix a bug.
This commit is contained in:
1 parent
e1d79d17c2
commit
d60dee11d0
4 files changed
+23
-24
No files matched your search
@@ -3,6 +3,8 @@ Auto IRC Bot 3.0: Change Log
|
|||||||
|
|
||||||
3.0 Indev
|
3.0 Indev
|
||||||
==================================================================
|
==================================================================
|
||||||
|
* Fixed a bug in API::Log that caused invalid months.
|
||||||
|
* Changed how command data is passed to fix a bug.
|
||||||
* Removed dependency Async.
|
* Removed dependency Async.
|
||||||
* Rewrote the socket engine.
|
* Rewrote the socket engine.
|
||||||
* Added cmd_add|del|run() to API::Std for commands.
|
* Added cmd_add|del|run() to API::Std for commands.
|
||||||
|
|||||||
@@ -92,6 +92,7 @@ sub expire_logs
|
|||||||
# Convert filename to UNIX time.
|
# Convert filename to UNIX time.
|
||||||
my $yyyy = substr($file, 0, 4);
|
my $yyyy = substr($file, 0, 4);
|
||||||
my $mm = substr($file, 4, 2);
|
my $mm = substr($file, 4, 2);
|
||||||
|
$mm = $mm - 1;
|
||||||
my $dd = substr($file, 6, 2);
|
my $dd = substr($file, 6, 2);
|
||||||
my $epoch = timelocal(0, 0, 0, $dd, $mm, $yyyy);
|
my $epoch = timelocal(0, 0, 0, $dd, $mm, $yyyy);
|
||||||
|
|
||||||
|
|||||||
@@ -123,21 +123,6 @@ sub cmd_del
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Run a command if it exists.
|
|
||||||
sub cmd_run
|
|
||||||
{
|
|
||||||
my ($cmd, $lvl, %src, @argv) = @_;
|
|
||||||
$cmd = uc($cmd);
|
|
||||||
|
|
||||||
return 0 if (!defined $CMDS{$cmd});
|
|
||||||
|
|
||||||
if ($CMDS{$cmd}{lvl} == $lvl or $CMDS{$cmd}{lvl} == 2) {
|
|
||||||
&{ $CMDS{$cmd}{sub} }(%src, @argv);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Add an event to Auto.
|
# Add an event to Auto.
|
||||||
sub event_add
|
sub event_add
|
||||||
{
|
{
|
||||||
|
|||||||
+20
-9
@@ -339,26 +339,37 @@ sub nick
|
|||||||
sub privmsg
|
sub privmsg
|
||||||
{
|
{
|
||||||
my ($svr, @ex) = @_;
|
my ($svr, @ex) = @_;
|
||||||
my %src = API::IRC::usrc(substr($ex[0], 1));
|
my %data = API::IRC::usrc(substr($ex[0], 1));
|
||||||
|
|
||||||
my $cprefix = (conf_get("fantasy_pf"))[0][0];
|
my @argv;
|
||||||
my $rprefix = substr($ex[3], 1, 1);
|
|
||||||
my $cmd = uc(substr($ex[3], 2));
|
|
||||||
my (@argv);
|
|
||||||
for (my $i = 4; $i < scalar(@ex); $i++) {
|
for (my $i = 4; $i < scalar(@ex); $i++) {
|
||||||
push(@argv, $ex[$i]);
|
push(@argv, $ex[$i]);
|
||||||
}
|
}
|
||||||
$src{svr} = $svr;
|
$data{svr} = $svr;
|
||||||
|
@{ $data{args} } = @argv;
|
||||||
|
|
||||||
|
my ($cmd, $cprefix, $rprefix);
|
||||||
# Check if it's to a channel or to us.
|
# Check if it's to a channel or to us.
|
||||||
if (lc($ex[2]) eq lc($botnick{$svr}{nick})) {
|
if (lc($ex[2]) eq lc($botnick{$svr}{nick})) {
|
||||||
# It is coming to us in a private message.
|
# It is coming to us in a private message.
|
||||||
API::Std::cmd_run($cmd, 1, %src, @argv);
|
$cmd = uc(substr($ex[3], 1));
|
||||||
|
if (defined $API::Std::CMDS{$cmd}) {
|
||||||
|
if ($API::Std::CMDS{$cmd}{lvl} == 1 or $API::Std::CMDS{$cmd}{lvl} == 2) {
|
||||||
|
&{ $API::Std::CMDS{$cmd}{sub} }(%data) if $rprefix eq $cprefix;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
# It is coming to us in a channel message.
|
# It is coming to us in a channel message.
|
||||||
$src{chan} = $ex[2];
|
$data{chan} = $ex[2];
|
||||||
API::Std::cmd_run($cmd, 0, %src, @argv);
|
$cprefix = (conf_get("fantasy_pf"))[0][0];
|
||||||
|
$rprefix = substr($ex[3], 1, 1);
|
||||||
|
$cmd = uc(substr($ex[3], 2));
|
||||||
|
if (defined $API::Std::CMDS{$cmd}) {
|
||||||
|
if ($API::Std::CMDS{$cmd}{lvl} == 0 or $API::Std::CMDS{$cmd}{lvl} == 2) {
|
||||||
|
&{ $API::Std::CMDS{$cmd}{sub} }(%data) if $rprefix eq $cprefix;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
Reference in new issue
Block a user