]> ruin.nu Git - NDIRC.git/blobdiff - Commands/Scans.pm
Handle scan requests
[NDIRC.git] / Commands / Scans.pm
index bc0f4c07014eecf0bceb969dacfc7cc3d6c61ab4..319e38cfef6eded49488b59bd855bff36f3414f9 100644 (file)
@@ -83,14 +83,14 @@ WHERE uid = $1
 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;
                        }
 
@@ -100,9 +100,9 @@ VALUES($1,$2,$3,$4) RETURNING (id)
                                }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{
@@ -121,6 +121,7 @@ my %scantypes;
 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;
@@ -198,20 +199,6 @@ SELECT ship,amount FROM fleet_ships WHERE fid = $1 ORDER BY num
        }
 };
 
-command anon => {
-       help => q(syntax: .anon nick message),
-       type => q(scan),
-       acl => q(irc_anonscan),
-}, class extends NDIRC::Command {
-       method execute($c,$msg) {
-               my ($target,$mess) = $msg =~ /^(\S+) (.*)$/ or die 'ARGS';
-
-               $c->message(privmsg => $target, "<b>$mess</b> <c04>(reply with /msg "
-                       .$c->channel.")</c>");
-               $c->message(privmsg => $c->channel, "<c03>$target << $mess</c>");
-       }
-};
-
 command addscan => {
        help => q(syntax: .addscan list of scans),
 }, class extends NDIRC::Command {