]> git.donarmstrong.com Git - infobot.git/blobdiff - src/Factoids/Statement.pl
changes for Debian stable/sarge, 3.1
[infobot.git] / src / Factoids / Statement.pl
index ed58a44800b193a5d1de32dcee50d2f5f4425674..6617dd649a692d42d16c8ad4688e4f3f73f351d8 100644 (file)
@@ -6,14 +6,14 @@
 ##  doStatement --
 ##
 ##     decide if $in is a statement, and if so,
-##             - update the dbm
+##             - update the db
 ##             - return feedback statement
 ##
 ##     otherwise return
 ##             - null for confused.
 ##
 
-if (&IsParam("useStrict")) { use strict; }
+# use strict;  # TODO
 
 sub doStatement {
     my($in) = @_;
@@ -55,8 +55,11 @@ sub doStatement {
     if ($in =~ /(^|\s)(is|are)(\s|$)/i) {
        my($lhs, $mhs, $rhs) = ($`, $&, $');
 
-       $lhs =~ tr/A-Z/a-z/;
-       $lhs =~ s/^(the|da|an?)\s+//i; # discard article
+       # allows factoid arguments to be updated. -lear.
+       $lhs =~ s/^(cmd: )?(.*)/$1||"" . lc $2/e;
+
+       # discard article.
+       $lhs =~ s/^(the|da|an?)\s+//i;
 
        # remove excessive initial and final whitespaces.
        $lhs =~ s/^\s+|\s+$//g;
@@ -65,7 +68,7 @@ sub doStatement {
 
        # break if either lhs or rhs is NULL.
        if ($lhs eq "" or $rhs eq "") {
-           return;
+           return "NOT-A-STATEMENT";
        }
 
        # lets check if it failed.
@@ -77,7 +80,9 @@ sub doStatement {
            return;
        }
 
-       return if (!$addressed and $lhs =~ /\s+/);
+       # uncomment to prevent HUNGRY learning of rhs with whitespace
+       #return if (!$addressed and $lhs =~ /\s+/);
+       &::DEBUG("doStatement: $in:$lhs:$mhs:$rhs");
 
        &status("statement: <$who> $message");
 
@@ -89,7 +94,7 @@ sub doStatement {
 
        # verify the update statement whether there are any weird
        # characters.
-       ### this chan be simplified.
+       ### this can be simplified.
        foreach (split //, $lhs.$rhs) {
            my $ord = ord $_;
            if ($ord > 170 and $ord < 220) {