]> git.donarmstrong.com Git - infobot.git/commitdiff
* Stop recursive is also loops
authordondelelcaro <dondelelcaro@c11ca15a-4712-0410-83d8-924469b57eb5>
Sat, 3 Jun 2006 01:04:42 +0000 (01:04 +0000)
committerdondelelcaro <dondelelcaro@c11ca15a-4712-0410-83d8-924469b57eb5>
Sat, 3 Jun 2006 01:04:42 +0000 (01:04 +0000)
git-svn-id: https://svn.code.sf.net/p/infobot/code/branches/don/dpkg@1276 c11ca15a-4712-0410-83d8-924469b57eb5

src/Factoids/Update.pl

index 400012e52387e126765c803dba173bf3966c8f82..475e0d9500b0b2acd04fef48d063f39811727936 100644 (file)
@@ -120,7 +120,23 @@ sub update {
     }
 
     if ($also) {                       # 'is also'.
-       if ($exists =~ /^<REPLY> see /i) {
+        my $redircount = 5;
+        my $origlhs = $lhs;
+        while ($exists =~ /^<REPLY> ?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 =~ /^<REPLY> ?see (.*)/i) {
            &TODO("Update.pl: append to linked factoid.");
        }