]> git.donarmstrong.com Git - infobot.git/blobdiff - src/Factoids/Question.pl
- comment out debug line for factoid args.
[infobot.git] / src / Factoids / Question.pl
index 2c1a6e5c5dc5232b6b6dca25109ec2b014d7bf85..8cadc924bab0bc0a633f39c2ce8aec670c669725 100644 (file)
@@ -11,7 +11,7 @@
 ##
 ##
 
-if (&IsParam("useStrict")) { use strict; }
+# use strict;  # TODO
 
 use vars qw($query $reply $finalQMark $nuh $result $talkok $who $nuh);
 use vars qw(%bots %forked);
@@ -38,6 +38,13 @@ sub doQuestion {
     } else {
        ### TODO: this should be caught in Process.pl?
        return '' unless ($talkok);
+
+       # there is no flag to disable/enable asking factoids...
+       # so it was added... thanks zyxep! :)
+       if (&IsFlag("a") ne "a" && &IsFlag("o") ne "o") {
+           &status("$who tried to ask us when not allowed.");
+           return;
+       }
     }
 
     # dangerous; common preambles should be stripped before here
@@ -102,13 +109,17 @@ sub doQuestion {
        while ($result =~ /^see( also)? (.*?)\.?$/) {
            my $link    = $2;
 
-           if (grep /^$link$/i, @link) {
+           # #debian@OPN was having problems with libstdc++ factoid
+           # redirection :) 20021116. -xk.
+           # hrm... allow recursive loops... next if statement handles
+           # that.
+           if (grep /^\Q$link\E$/i, @link) {
                &status("recursive link found; bailing out.");
                last;
            }
 
            if (scalar @link >= 5) {
-               &status("recursive link limit reached.");
+               &status("recursive link limit (5) reached.");
                last;
            }
 
@@ -183,7 +194,7 @@ sub factoidArgs {
        next if (/#DEL#/);      # deleted.
 
        s/^CMD: //i;
-#      &DEBUG("factarg: ''$str' =~ /^$_\$/'");
+#      &DEBUG("factarg: '$str' =~ /^$_\$/");
        my $arg = $_;
 
        # todo: <greycat> ~punish apt for (Eating) (Parentheses)