From: dondelelcaro Date: Sat, 3 Jun 2006 01:04:42 +0000 (+0000) Subject: * Stop recursive is also loops X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=f3618054e8879cfcc83a1e0c1d3aceb83a092ed7;p=infobot.git * Stop recursive is also loops git-svn-id: https://svn.code.sf.net/p/infobot/code/branches/don/dpkg@1276 c11ca15a-4712-0410-83d8-924469b57eb5 --- diff --git a/src/Factoids/Update.pl b/src/Factoids/Update.pl index 400012e..475e0d9 100644 --- a/src/Factoids/Update.pl +++ b/src/Factoids/Update.pl @@ -120,7 +120,23 @@ sub update { } if ($also) { # 'is also'. - if ($exists =~ /^ see /i) { + 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."); }