From: dms Date: Sun, 24 Sep 2000 11:50:44 +0000 (+0000) Subject: added 'debianForFactoid'. X-Git-Url: https://git.donarmstrong.com/?p=infobot.git;a=commitdiff_plain;h=6397dda3f0c4073366cf0d6e6f93790c05d14839 added 'debianForFactoid'. fixed question 'you suck'. found by cerb. git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk/blootbot@138 c11ca15a-4712-0410-83d8-924469b57eb5 --- diff --git a/src/Factoids/Question.pl b/src/Factoids/Question.pl index 6b1e385..56a3a53 100644 --- a/src/Factoids/Question.pl +++ b/src/Factoids/Question.pl @@ -23,14 +23,14 @@ sub doQuestion { local($reply) = ""; local $finalQMark = $query =~ s/\?+\s*$//; $finalQMark += $query =~ s/\?\s*$//; + $query =~ s/^\s+|\s+$//g; if (!defined $query or $query =~ /^\s*$/) { &FIXME("doQ: query == NULL"); return ''; } - my $origQuery = $query; - + my $origQuery = $query; my $questionWord = ""; if (!$addressed) { @@ -48,8 +48,18 @@ sub doQuestion { } # convert to canonical reference form - $query = &normquery($query); - $query = &switchPerson($query); + my $x; + my @query; + + push(@query, $query); # 1: push original. + + $x = &normquery($query); + push(@query, $x) if ($x ne $query); + $query = $x; + + $x = &switchPerson($query); + push(@query, $x) if ($x ne $query); + $query = $x; $query =~ s/\s+at\s*(\?*)$/$1/; # where is x at? $query =~ s/^explain\s*(\?*)/$1/i; # explain x @@ -67,17 +77,14 @@ sub doQuestion { $questionWord = "where"; } - $query =~ s/^\s+|\s+$//g; - # valid factoid. - my @query; - push(@query, $query); if ($query =~ s/[\!\.]$//) { &DEBUG("Question: Pushing query without trailing symbols."); push(@query,$query); } - foreach $query (@query) { + for (my$i=0; $i '$query'."); + } + return $result; } @@ -96,7 +107,15 @@ sub doQuestion { $result = &Freshmeat::showPackage($query); return $result unless ($result eq $noreply); } - &DEBUG("Question: hrm... result => '$result' for '$query'."); + + ### TODO: Use &Forker(); move function to Debian.pl + if (&IsParam("debianForFactoid")) { + &loadMyModule($myModules{'debian'}); + $result = &Debian::DebianFind($query); # ??? + ### TODO: debian module should tell, through shm, that it went + ### ok or not. +### return $result unless ($result eq $noreply); + } if ($questionWord ne "" or $finalQMark) { # if it has not been explicitly marked as a question