UPDATE scan_requests SET nick = $1, tick = tick(), time = NOW()
WHERE id = $2
});
- $req->execute($c->nick,$scan->{id});
+ $req->execute($c->replyId,$scan->{id});
$id = $scan->{id};
}else{
$req = $c->model->prepare(q{
INSERT INTO scan_requests (uid,nick,pid,type)
VALUES($1,$2,$3,$4) RETURNING (id)
});
- $req->execute($c->uid,$c->nick,$planet,$type);
+ $req->execute($c->uid,$c->replyId,$planet,$type);
$id = $req->fetchrow;
}
}else{
$dists = "DISTS UNKNOWN, ADD DEVSCAN"
}
- $c->message(privmsg => $c->disp->targets->{scan}
- ,"<b>$id</b> http://game.planetarion.com/waves.pl?id=$typeid&x=$x&y=$y&z=$z"
- . " ($x:$y:$z $type - $dists) | <".$c->nick."> $msg"
+ $c->bot->toTarget( scan =>
+ "<b>$id</b> http://game.planetarion.com/waves.pl?id=$typeid&x=$x&y=$y&z=$z"
+ . " ($x:$y:$z $type - $dists) | <".$c->username."> $msg"
);
$c->reply("sent request ($x:$y:$z $type)");
}else{
command scanreqs => {
help => q(syntax: .scanreqs [-pdunja] | Lists scan requests that haven't been handled. The argument can be used to omit types you don't have, like .scanreqs -ja to list all requests except jumpgates and advanced unit scans.),
acl => q(irc_scanreqs),
+ type => q{scan},
}, class extends NDIRC::Command {
method execute($c,$msg) {
my @notype;
lazy_build => 1
);
+has username => (
+ is => 'ro',
+ isa => 'Str',
+ lazy_build => 1
+);
+
has disp => (
is => 'ro',
isa => 'Object',
sub message {
}
+sub replyId {
+}
+
sub intel_log {
my ($c,$planet, $message) = @_;
my $log = $c->model->prepare_cached(q{
return -4;
}
+sub _build_username {
+ my ($self) = @_;
+
+ my $query = $self->model->prepare(q{
+SELECT username FROM users
+WHERE uid = $1
+ });
+ $query->execute($self->uid);
+
+ if (my ($username) = $query->fetchrow_array){
+ $query->finish;
+ return $username;
+ }
+ return "Anonymous";
+}
+
sub valuecolor {
shift @_;
my $s = $_;
});
$scans->execute;
while (my $scan = $scans->fetchrow_hashref){
- $heap->{irc}->yield(notice => $scan->{nick}, "($scan->{coords} $scan->{type})"
- ." http://game.planetarion.com/showscan.pl?scan_id=$scan->{scan_id}");
+ $self->message("($scan->{coords} $scan->{type})"
+ ." http://game.planetarion.com/showscan.pl?scan_id=$scan->{scan_id}"
+ , @{$scan->{nick}});
$sentscan->execute($scan->{id});
}