From f3618054e8879cfcc83a1e0c1d3aceb83a092ed7 Mon Sep 17 00:00:00 2001 From: dondelelcaro Date: Sat, 3 Jun 2006 01:04:42 +0000 Subject: [PATCH 1/1] * 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 --- src/Factoids/Update.pl | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) 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."); } -- 2.39.2