X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=src%2FFactoids%2FQuestion.pl;h=39b5df2644fc7ca36e532233b2f697ceb4ce781b;hb=cb81fea9939f349b36e3b5a0cdc0343a6b781da1;hp=44fd742557934a433aaced5c02ac23cffd985c16;hpb=11e57f735626f775a95284a0d8ff284ec3617dc7;p=infobot.git diff --git a/src/Factoids/Question.pl b/src/Factoids/Question.pl index 44fd742..39b5df2 100644 --- a/src/Factoids/Question.pl +++ b/src/Factoids/Question.pl @@ -20,7 +20,7 @@ sub doQuestion { # my doesn't allow variables to be inherinted, local does. # following is used in math()... local($query) = @_; - local($reply) = ""; + local($reply) = ''; local $finalQMark = $query =~ s/\?+\s*$//; $finalQMark += $query =~ s/\?\s*$//; $query =~ s/^\s+|\s+$//g; @@ -29,11 +29,11 @@ sub doQuestion { return ''; } - my $questionWord = ""; + my $questionWord = ''; if (!$addressed) { return '' unless ($finalQMark); - return '' unless &IsChanConf("minVolunteerLength") > 0; + return '' unless &IsChanConf('minVolunteerLength') > 0; return '' if (length $query < &::getChanConf('minVolunteerLength')); } else { ### TODO: this should be caught in Process.pl? @@ -41,7 +41,7 @@ sub doQuestion { # there is no flag to disable/enable asking factoids... # so it was added... thanks zyxep! :) - if (&IsFlag("a") ne "a" && &IsFlag("o") ne "o") { + if (&IsFlag('a') ne 'a' && &IsFlag('o') ne 'o') { &status("$who tried to ask us when not allowed."); return; } @@ -87,13 +87,13 @@ sub doQuestion { $questionWord = lc($1); } - if ($questionWord eq "" and $finalQMark and $addressed) { - $questionWord = "where"; + if ($questionWord eq '' and $finalQMark and $addressed) { + $questionWord = 'where'; } $query =~ s/^\s+|\s+$//g; # bleh. hacked. push(@query, $query) if ($query ne $x); - if (&IsChanConf("factoidArguments") > 0) { + if (&IsChanConf('factoidArguments') > 0) { $result = &factoidArgs($query[0]); return $result if (defined $result); @@ -103,7 +103,7 @@ sub doQuestion { for (my$i=0; $i ".join(' :: ', @query)) if ($finalQMark); - return '' unless (&IsParam("friendlyBots")); + return '' unless (&IsParam('friendlyBots')); foreach (split /\s+/, $param{'friendlyBots'}) { &msg($_, ":INFOBOT:QUERY <$who> $query"); @@ -191,7 +191,7 @@ sub factoidArgs { # ignore split to commands [dumb commands vs. factoids] (editing commands?) return undef if $str =~ /\s+\=\~\s+s[\#\/\:]/; - my @list = &searchTable("factoids", "factoid_key", "factoid_key", "^cmd: $first "); + my @list = &searchTable('factoids', 'factoid_key', 'factoid_key', "^cmd: $first "); # my $delta_time = &timedelta($t); # &DEBUG("factArgs: delta_time = $delta_time s"); # &DEBUG("factArgs: list => ".scalar(@list) ); @@ -238,9 +238,9 @@ sub factoidArgs { } # update stats. old mysql/sqlite don't do +1 - my ($count) = &sqlSelect("factoids", "requested_count", { factoid_key => $q }); + my ($count) = &sqlSelect('factoids', 'requested_count', { factoid_key => $q }); $count++; - &sqlSet("factoids", {'factoid_key' => $q}, { + &sqlSet('factoids', {'factoid_key' => $q}, { requested_by => $nuh, requested_time => time(), requested_count => $count @@ -301,3 +301,5 @@ sub factoidArgs { } 1; + +# vim:ts=4:sw=4:expandtab:tw=80