diff --git a/lib/commands/get.pm b/lib/commands/get.pm index 38ed533df86e85d4a30cfb68d6936be65ff2c7dc..e33272863cfa34e59bdcd105e944450443e78987 100644 --- a/lib/commands/get.pm +++ b/lib/commands/get.pm @@ -10,9 +10,10 @@ use Scalar::Util qw(looks_like_number); our $dbh; our $irc; +our $log; sub exec { - my ($kernel, $user, $chan, $msg) = @_; + my ($kernel, $nick, $chan, $msg) = @_; # if we are in a query or arg -all, we search in all the channels my $all = 0; @@ -141,6 +142,15 @@ sub exec { $irc->yield(privmsg => $chan => '['.$content->[0].'] '.$content->[2].' => '.$content->[3].' '.$tags) ; } + # we save the get like a post + my $sth2 = $dbh->prepare_cached(' + INSERT INTO playbot_chan (content, chan, sender_irc) + VALUES (?,?,?)'); + $log->error("Couldn't prepare querie; aborting") unless (defined $sth2); + + $sth2->execute($content->[0], $chan->[0], $nick) + or $log->error("Couldn't finish transaction: " . $dbh->errstr); + return $content->[0]; } diff --git a/lib/commands/parser.pm b/lib/commands/parser.pm index 17be6341e232036fe6737941f9791ee4a7a1283e..c8b925c1e8e5394050676fa1f634921e815b20c3 100644 --- a/lib/commands/parser.pm +++ b/lib/commands/parser.pm @@ -25,6 +25,7 @@ sub setConf { $commands::fav::log = $log; $commands::tag::log = $log; + $commands::get::log = $log; $commands::later::log = $log; $commands::fav::irc = $ircNew; @@ -64,7 +65,7 @@ sub exec { } elsif ($msg =~ /^( *!get)(?: +.*)?$/) { $msg = substr $msg, (length $1) + 1; - my @args = ($kernel, $user, $chan, $msg); + my @args = ($kernel, $nick, $chan, $msg); my $id = commands::get::exec(@args); if ($id) {