]> ruin.nu Git - NDIRC.git/blobdiff - Commands/Scans.pm
Introduce a uid member for the context and use it intead of the host in commands
[NDIRC.git] / Commands / Scans.pm
index 315903190c6ddf5b5e15e57f4d5c9cf9c3ed10a6..ffc8e184023a0b31d09ce894de92346ae103cff3 100644 (file)
@@ -70,10 +70,10 @@ sub gs
        }else{
                my $req = $c->model->prepare(q{
 SELECT * FROM scan_requests
-WHERE uid = (SELECT uid FROM users WHERE hostmask ILIKE $1)
+WHERE uid = $1
        AND pid = $2 AND type = $3 AND NOT sent
                });
-               $req->execute($c->host,$planet,$type);
+               $req->execute($c->uid,$planet,$type);
 
                my $id;
                if(my $scan = $req->fetchrow_hashref){
@@ -86,14 +86,14 @@ WHERE id = $2
                }else{
                        $req = $c->model->prepare(q{
 INSERT INTO scan_requests (uid,nick,pid,type)
-VALUES((SELECT uid FROM users WHERE hostmask ILIKE $1),$2,$3,$4) RETURNING (id)
+VALUES($1,$2,$3,$4) RETURNING (id)
                        });
-                       $req->execute($c->host,$c->nick,$planet,$type);
+                       $req->execute($c->uid,$c->nick,$planet,$type);
                        $id = $req->fetchrow;
                }
 
                if ($id){
-                       $c->message(privmsg =>$c->disp->targets->{scans}
+                       $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) | <".$c->nick."> $msg"
                        );
@@ -217,7 +217,7 @@ WHERE groupscan = $1 AND scan_id = LOWER($2) AND tick >= tick() - 168
 INSERT INTO scans (scan_id,tick,groupscan,uid) VALUES (LOWER($1),tick(),$2,COALESCE($3,-1))
                });
        my $user = $dbh->selectrow_hashref(q{SELECT uid,username, scan_points, tick()
-               FROM users WHERE hostmask ILIKE ? },undef,$c->host);
+               FROM users WHERE uid = ? },undef,$c->uid);
        my $groupscans = 0;
        my $scans = 0;
        eval {