}
$message =~ tr/A-Z/a-z/;
+ $message =~ s/^cmd:/CMD:/;
+
+ my ($count, $fauthor, $result) = &sqlSelect("factoids",
+ "requested_count,created_by,factoid_value",
+ { factoid_key => $message }
+ );
- my ($result, $fauthor, $count) = &dbGet("factoids",
- "factoid_value,created_by,requested_count", "factoid_key=".&dbQuote($message) );
if ($result) {
$lhs = $message;
$mhs = "is";
### FIXME: old mysql doesn't support
### "requested_count=requested_count+1".
$count++;
- &dbSet("factoids", {'factoid_key' => $lhs}, {
+ &sqlSet("factoids", {'factoid_key' => $lhs}, {
requested_by => $nuh,
requested_time => time(),
requested_count => $count
foreach (split //, $string) {
if ($_ eq "(") {
-### print "( l=>$l, r=>$r\n";
-
if (!$l and !$r) {
-# print "STARTING at $i\n";
$s = $i;
$t = $i;
}
}
if ($_ eq ")") {
-### print ") l=>$l, r=>$r\n";
-
$r++;
$l--;
if (!$l and !$r) {
my $substr = substr($old,$s,$i-$s+1);
-# print "STOP at $i $substr\n";
push(@rand, substr($old,$t+1,$i-$t-1) );
my $rand = $rand[rand @rand];
- &status("SARing '$substr' to '$rand'.");
+# &status("SARing '$substr' to '$rand'.");
$string =~ s/\Q$substr\E/$rand/;
undef @rand;
}
}
if ($_ eq "|" and $l+$r== 0 and $l==1) {
-# print "| at $i (l=>$l,r=>$r)\n";
push(@rand, substr($old,$t+1,$i-$t-1) );
$t = $i;
}