X-Git-Url: https://git.donarmstrong.com/?p=infobot.git;a=blobdiff_plain;f=src%2FFactoids%2FStatement.pl;h=48b10cb70944afcd70ce7c6bc0b2e95c8afec48a;hp=2c5a8e219451af9fa2fcf8f037c608c8c502b0b3;hb=ab817c7c909abba1654f3b8691961ec8694e8169;hpb=1b325d96346dbd17a6c8c2a99bdd63ddb6ab70f7 diff --git a/src/Factoids/Statement.pl b/src/Factoids/Statement.pl index 2c5a8e2..48b10cb 100644 --- a/src/Factoids/Statement.pl +++ b/src/Factoids/Statement.pl @@ -58,6 +58,24 @@ sub doStatement { if ( $in =~ /(^|\s)(is|are)(\s|$)/i ) { my ( $lhs, $mhs, $rhs ) = ( $`, $&, $' ); + # Quit if they are over the limits. Check done here since Core.pl calls + # this mid sub and Question.pl needs its own check as well. NOTE: $in is + # used in this place since lhs and rhs are really undefined for unwanted + # teaching. Mainly, the "is" could be anywhere within a 510 byte or so + # block of text, so the total size was choosen since the sole purpose of + # this logic is to not hammer the db with pointless factoids that were + # only meant to be general conversation. + return '' + if ( + length $in < + &::getChanConfDefault( 'minVolunteerLength', 2, $chan ) or + $param{'addressing'} =~ m/require/i ) and not $addressed; + return '' + if ( + length $in > + &::getChanConfDefault( 'maxVolunteerLength', 512, $chan ) or + $param{'addressing'} =~ m/require/i ) and not $addressed; + # allows factoid arguments to be updated. -lear. $lhs =~ s/^(cmd: )?(.*)/$1||'' . lc $2/e;