]> ruin.nu Git - NDIRC.git/blobdiff - Commands/SMS.pm
Introduce a uid member for the context and use it intead of the host in commands
[NDIRC.git] / Commands / SMS.pm
index 265384ddd9dae941b2e6c1f5d266d028fb3a5838..eba2d650b72d79919f99a67cd83b1830a2d30e5d 100644 (file)
@@ -45,7 +45,7 @@ sub sendsms
        }else{
                my ($sms) = $dbh->selectrow_array(q{
 SELECT sms FROM users WHERE username ilike $1
-       AND uid IN (SELECT uid FROM groupmembers WHERE gid = 2)
+       AND uid IN (SELECT uid FROM groupmembers WHERE gid = 'M')
                        },undef,$number);
                $sms //= 'No number, or invalid user';
                if ($sms =~ /^\+([1-9]\d+)$/){
@@ -57,10 +57,10 @@ SELECT sms FROM users WHERE username ilike $1
        }
        my $sms = $dbh->prepare(q{
 INSERT INTO sms (uid,number,message)
-VALUES((SELECT uid FROM users WHERE hostmask ilike $1),$2,$3)
+VALUES($1,$2,$3)
 RETURNING id
                });
-       $sms->execute($c->host,$number,$message);
+       $sms->execute($c->uid,$number,$message);
        my ($id) = $sms->fetchrow_array;
        $c->reply("Message added to queue, you can see the status with: .smsstatus $id");
 }