]> git.donarmstrong.com Git - infobot.git/commitdiff
* Merge Don's factoid update recusion check patch
authordjmcgrath <djmcgrath@c11ca15a-4712-0410-83d8-924469b57eb5>
Fri, 19 Oct 2007 09:28:36 +0000 (09:28 +0000)
committerdjmcgrath <djmcgrath@c11ca15a-4712-0410-83d8-924469b57eb5>
Fri, 19 Oct 2007 09:28:36 +0000 (09:28 +0000)
git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk@1568 c11ca15a-4712-0410-83d8-924469b57eb5

src/Factoids/Update.pl

index b94826635823e5224d65ac9d660c97d3d889e203..1d662940874a7e881a4c491f3ba975b483383074 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.");
        }