-
-# infobot :: Kevin Lenzo (c) 1997
+###
+### Statement.pl: Kevin Lenzo (c) 1997
+###
##
## doStatement --
##
## otherwise return
## - null for confused.
-## - NOREPLY not to respond.
##
-if (&IsParam("useStrict")) { use strict; }
+# use strict; # TODO
sub doStatement {
my($in) = @_;
$in =~ s/^no([, ]+)//i; # 'no, '.
# check if we need to be addressed and if we are
- return 'NOREPLY' unless ($learnok);
+ return unless ($learnok);
my($urlType) = "";
$in =~ s/ www\./ http:\/\/www\./ig;
$in =~ s/ ftp\./ ftp:\/\/ftp\./ig;
- # look for a "type nugget". this should be externalized.
- $urlType = "mailto" if ($in =~ /\bmailto:.+\@.+\..{2,}/i);
- $urlType = "mailto" if ($in =~ s/\b(\S+\@\S+\.\S{2,})/mailto:$1/gi);
- $in =~ s/(mailto:)+/mailto:/g;
-
$urlType = "about" if ($in =~ /\babout:/i);
$urlType = 'afp' if ($in =~ /\bafp:/);
$urlType = 'file' if ($in =~ /\bfile:/);
# acceptUrl.
if (&IsParam("acceptUrl")) {
if ($param{'acceptUrl'} eq 'REQUIRE') { # require url type.
- return 'NOREPLY' if ($urlType eq "");
+ return if ($urlType eq "");
} elsif ($param{'acceptUrl'} eq 'REJECT') {
&status("REJECTED URL entry") if (&IsParam("VERBOSITY"));
- return 'NOREPLY' unless ($urlType eq "");
+ return unless ($urlType eq "");
} else {
# OPTIONAL
}
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;
# break if either lhs or rhs is NULL.
if ($lhs eq "" or $rhs eq "") {
- return 'NOREPLY';
+ return "NOT-A-STATEMENT";
}
# lets check if it failed.
if (&validFactoid($lhs,$rhs) == 0) {
if ($addressed) {
&status("IGNORE statement: <$who> $message");
- &performReply( &getRandom(keys %{$lang{'confused'}}) );
+ &performReply( &getRandom(keys %{ $lang{'confused'} }) );
}
- return 'NOREPLY';
+ return;
}
- return 'NOREPLY' if (!$addressed and $lhs =~ /\s+/);
+ return if (!$addressed and $lhs =~ /\s+/);
&status("statement: <$who> $message");
if ($ord > 170 and $ord < 220) {
&status("statement: illegal character '$_' $ord.");
&performAddressedReply("i'm not going to learn illegal characters");
- return 'NOREPLY';
+ return;
}
}
- return &update($lhs, $mhs, $rhs);
+ # success.
+ return if (&update($lhs, $mhs, $rhs));
}
- return '';
+ return "CONTINUE";
}
1;