- $result = &SARit($result);
-
- $reply = $result;
- if ($result ne "") {
- ### AT LAST, REPEAT PREVENTION CODE REMOVED IN FAVOUR OF GLOBAL
- ### FLOOD REPETION AND PROTECTION. -20000124
-
- # stats code.
- ### FIXME: old mysql doesn't support
- ### "requested_count=requested_count+1".
- $count++;
- ### BROKEN!!! - Tim Riker <Tim@Rikers.org> says it's fixed now
- if (0) { # old code.
- &setFactInfo($lhs,"requested_by", $nuh);
- &setFactInfo($lhs,"requested_time", time());
- &setFactInfo($lhs,"requested_count", $count);
- } else {
- &dbSet("factoids", {'factoid_key' => $lhs}, {
- requested_by => $nuh,
- requested_time => time(),
- requested_count => $count
- } );
- }
-
- # todo: rename $real to something else!
- my $real = 0;
-# my $author = &getFactInfo($lhs,"created_by") || '';
-# $real++ if ($author =~ /^\Q$who\E\!/);
-# $real++ if (&IsFlag("n"));
- $real = 0 if ($msgType =~ /public/);
-
- ### fix up the reply.
- # only remove '<reply>'
- if (!$real and $reply =~ s/^\s*<reply>\s*//i) {
- # 'are' fix.
- if ($reply =~ s/^are /$lhs are /i) {
- &VERB("Reply.pl: el-cheapo 'are' fix executed.",2);
- }
-
- } elsif (!$real and $reply =~ s/^\s*<action>\s*(.*)/\cAACTION $1\cA/i) {
- # only remove '<action>' and make it an action.
- } else { # not a short reply
-
- ### bot->bot reply.
- if (exists $bots{$nuh} and $rhs !~ /^\s*$/) {
- return "$lhs $mhs $rhs";
- }
-
- ### bot->person reply.
- # result is random if separated by '||'.
- # rhs is full factoid with '||'.
- if ($mhs eq "is") {
- $reply = &getRandom(keys %{ $lang{'factoid'} });
- $reply =~ s/##KEY/$lhs/;
- $reply =~ s/##VALUE/$result/;
- } else {
- $reply = "$lhs $mhs $result";
- }
-
- if ($reply =~ s/^\Q$who\E is/you are/i) {
- # fix the person.
- } else {
- if ($reply =~ /^you are / or $reply =~ / you are /) {
- return if ($addressed);
- }
- }
- }
+ $result = &SARit($result);
+
+ $reply = $result;
+ if ( $result ne '' ) {
+ ### AT LAST, REPEAT PREVENTION CODE REMOVED IN FAVOUR OF GLOBAL
+ ### FLOOD REPETION AND PROTECTION. -20000124
+
+ # stats code.
+ ### FIXME: old mysql/sqlite doesn't support
+ ### "requested_count=requested_count+1".
+ $count++;
+ &sqlSet(
+ 'factoids',
+ { 'factoid_key' => $factoid },
+ {
+ requested_by => $nuh,
+ requested_time => time(),
+ requested_count => $count
+ }
+ );
+
+ # TODO: rename $real to something else!
+ my $real = 0;
+
+ # my $author = &getFactInfo($lhs,'created_by') || '';
+ # $real++ if ($author =~ /^\Q$who\E\!/);
+ # $real++ if (&IsFlag('n'));
+ $real = 0 if ( $msgType =~ /public/ );
+
+ ### fix up the reply.
+ # only remove '<reply>'
+ if ( !$real and $reply =~ s/^\s*<reply>\s*//i ) {
+
+ # 'are' fix.
+ if ( $reply =~ s/^are /$lhs are /i ) {
+ &VERB( "Reply.pl: el-cheapo 'are' fix executed.", 2 );
+ }
+
+ }
+ elsif ( !$real and $reply =~ s/^\s*<action>\s*(.*)/\cAACTION $1\cA/i ) {
+
+ # only remove '<action>' and make it an action.
+ }
+ else { # not a short reply
+
+ ### bot->bot reply.
+ if ( exists $bots{$nuh} and $rhs !~ /^\s*$/ ) {
+ return "$lhs $mhs $rhs";
+ }
+
+ ### bot->person reply.
+ # result is random if separated by '||'.
+ # rhs is full factoid with '||'.
+ if ( $mhs eq 'is' ) {
+ $reply = &getRandom( keys %{ $lang{'factoid'} } );
+ $reply =~ s/##KEY/$lhs/;
+ $reply =~ s/##VALUE/$result/;
+ }
+ else {
+ $reply = "$lhs $mhs $result";
+ }
+
+ if ( $reply =~ s/^\Q$who\E is/you are/i ) {
+
+ # fix the person.
+ }
+ else {
+ if ( $reply =~ /^you are / or $reply =~ / you are / ) {
+ return if ($addressed);
+ }
+ }
+ }