]> git.donarmstrong.com Git - infobot.git/blobdiff - src/Factoids/Update.pl
* Try updating Debian.pl again
[infobot.git] / src / Factoids / Update.pl
index 3de1ad7c0674ac4b60b81a80b2be80081f41025f..475e0d9500b0b2acd04fef48d063f39811727936 100644 (file)
@@ -52,26 +52,16 @@ sub update {
     my $also    = ($rhs =~ s/^-?also //i);
     my $also_or = ($also and $rhs =~ s/\s+(or|\|\|)\s+//);
 
-    # freshmeat
-    if (&IsChanConf("freshmeatForFactoid")) {
-       # todo: "name" is invalid for fm ][
-       if ( &sqlSelect("freshmeat", "name", { name => $lhs } ) ) {
-           &msg($who, "permission denied. (freshmeat)");
-           &status("alert: $who wanted to teach me something that freshmeat already has info on.");
-           return 1;
-       }
-    }
-
     # factoid arguments handler.
     # must start with a non-variable
-    if (&IsChanConf("factoidArguments") and $lhs =~ /^[^\$]+.*\$/) {
+    if (&IsChanConf("factoidArguments") > 0 and $lhs =~ /^[^\$]+.*\$/) {
        &status("Update: Factoid Arguments found.");
        &status("Update: orig lhs => '$lhs'.");
        &status("Update: orig rhs => '$rhs'.");
 
        my @list;
        my $count = 0;
-       $lhs =~ s/^/CMD: /;
+       $lhs =~ s/^/cmd: /;
        while ($lhs =~ s/\$(\S+)/(.*?)/) {
            push(@list, "\$$1");
            $count++;
@@ -130,8 +120,24 @@ sub update {
     }
 
     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 ($exists =~ /^<REPLY> ?see (.*)/i) {
+           &TODO("Update.pl: append to linked factoid.");
        }
 
        if ($also_or) {                 # 'is also ||'.