From 9d69fa18507c1f896c9c70b6f292d87a75821f1d Mon Sep 17 00:00:00 2001 From: dms Date: Mon, 18 Sep 2000 11:44:29 +0000 Subject: [PATCH] Trailing symbols (.!) ignored on question Founded by Flugh git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk@113 c11ca15a-4712-0410-83d8-924469b57eb5 --- blootbot/src/Factoids/Question.pl | 37 ++++++++++++++++++------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/blootbot/src/Factoids/Question.pl b/blootbot/src/Factoids/Question.pl index 37d89dc..6b1e385 100644 --- a/blootbot/src/Factoids/Question.pl +++ b/blootbot/src/Factoids/Question.pl @@ -35,12 +35,8 @@ sub doQuestion { if (!$addressed) { return '' unless ($finalQMark); - - if (&IsParam("minVolunteerLength") == 0 or - length($query) < $param{'minVolunteerLength'}) - { - return ''; - } + return '' if (&IsParam("minVolunteerLength") == 0); + return '' if (length($query) < $param{'minVolunteerLength'}); } else { ### TODO: this should be caught in Process.pl? return '' unless ($talkok); @@ -74,24 +70,33 @@ sub doQuestion { $query =~ s/^\s+|\s+$//g; # valid factoid. - if (defined( $result = &getReply($query) )) { + my @query; + push(@query, $query); + if ($query =~ s/[\!\.]$//) { + &DEBUG("Question: Pushing query without trailing symbols."); + push(@query,$query); + } + + foreach $query (@query) { + $result = &getReply($query); + next if ($result eq ""); + # 'see also' factoid redirection support. if ($result =~ /^see( also)? (.*?)\.?$/) { my $newr = &getReply($2); $result = $newr if ($newr ne ""); } - return $result if ($result ne ""); - - ### TODO: Use &Forker(); move function to Freshmeat.pl. - if (&IsParam("freshmeatForFactoid")) { - &loadMyModule($myModules{'freshmeat'}); - $result = &Freshmeat::showPackage($query); - return $result unless ($result eq $noreply); - } + return $result; + } - &DEBUG("Question: hrm... result => '$result'."); + ### TODO: Use &Forker(); move function to Freshmeat.pl. + if (&IsParam("freshmeatForFactoid")) { + &loadMyModule($myModules{'freshmeat'}); + $result = &Freshmeat::showPackage($query); + return $result unless ($result eq $noreply); } + &DEBUG("Question: hrm... result => '$result' for '$query'."); if ($questionWord ne "" or $finalQMark) { # if it has not been explicitly marked as a question -- 2.39.5