Package: blootbot
Severity: normal
Tags: patch

If you try to use "is also" to append to a factoid which was redirected
factoid ("b is <reply> see a"), instead of appending to the original
factoid, you break the redirection.  Attached is a patch which will
cause it to instead append the new text to the factiod which is referred
to.  For example:

10:46 <stew> no a is a
10:46 <bot> okay, stew
10:47 <stew> no b is <reply> see a
10:47 <bot> okay
10:47 <stew> a
10:47 <bot> a is, like, a
10:47 <stew> b
10:47 <bot> well, a is a
10:47 <stew> b is also aaa
10:47 <bot> okay, stew
10:47 <stew> a
10:47 <bot> extra, extra, read all about it, a is a, or aaa
10:47 <stew> b
10:47 <bot> [a] a, or aaa


diff -ru blootbot-1.2.0.orig/src/Factoids/Update.pl 
blootbot-1.2.0/src/Factoids/Update.pl
--- blootbot-1.2.0.orig/src/Factoids/Update.pl  2006-06-03 10:31:26.000000000 
-0400
+++ blootbot-1.2.0/src/Factoids/Update.pl       2006-06-03 10:39:41.000000000 
-0400
@@ -137,9 +137,22 @@
     }
 
     if ($also) {                       # 'is also'.
-       if ($exists =~ /^<REPLY> see /i) {
-           &DEBUG("Update.pl: todo: append to linked factoid.");
-       }
+        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 ($also_or) {                 # 'is also ||'.
            $rhs = $exists.' || '.$rhs;



-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (990, 'unstable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.15-1-k7-smp
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to