X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=src%2FFactoids%2FUpdate.pl;h=475e0d9500b0b2acd04fef48d063f39811727936;hb=043ce88123ea9e9584665dedd5025cb49c53908d;hp=c41c9e6e4c00fee09635b2885de70eb583c0f3b9;hpb=a2b3be31bf664fe2cca6298b58e3c828a46a40f4;p=infobot.git diff --git a/src/Factoids/Update.pl b/src/Factoids/Update.pl index c41c9e6..475e0d9 100644 --- a/src/Factoids/Update.pl +++ b/src/Factoids/Update.pl @@ -54,14 +54,14 @@ sub update { # factoid arguments handler. # must start with a non-variable - if (&IsChanConf("factoidArguments") and $lhs =~ /^[^\$]+.*\$/) { + if (&IsChanConf("factoidArguments") > 0 and $lhs =~ /^[^\$]+.*\$/) { &status("Update: Factoid Arguments found."); &status("Update: orig lhs => '$lhs'."); &status("Update: orig rhs => '$rhs'."); my @list; my $count = 0; - $lhs =~ s/^/CMD: /; + $lhs =~ s/^/cmd: /; while ($lhs =~ s/\$(\S+)/(.*?)/) { push(@list, "\$$1"); $count++; @@ -120,8 +120,24 @@ sub update { } if ($also) { # 'is also'. - if ($exists =~ /^ see /i) { - &DEBUG("Update.pl: todo: append to linked factoid."); + my $redircount = 5; + my $origlhs = $lhs; + while ($exists =~ /^ ?see (.*)/i) { + $redircount--; + unless ($redircount) { + &msg($who, "$origlhs has too many levels of redirection."); + return 1; + } + + $lhs = $1; + $exists = &getFactoid($lhs); + unless( $exists ) { + &msg($who, "$1 is a dangling redirection."); + return 1; + } + } + if ($exists =~ /^ ?see (.*)/i) { + &TODO("Update.pl: append to linked factoid."); } if ($also_or) { # 'is also ||'.