]> git.donarmstrong.com Git - infobot.git/blobdiff - src/Factoids/Update.pl
- I broke maths when I tried to fix "999!" - fixed :-)
[infobot.git] / src / Factoids / Update.pl
index 79abd84c1d9a3e2c0b70f0050dac60338d6e3951..5fa7c4edceef36f11ce89d12cd618bcb5309fddf 100644 (file)
@@ -54,6 +54,7 @@ sub update {
 
     # freshmeat
     if (&IsChanConf("freshmeatForFactoid")) {
+       # todo: "name" is invalid for fm ][
        if (&dbGet("freshmeat", "name", $lhs, "name")) {
            &msg($who, "permission denied. (freshmeat)");
            &status("alert: $who wanted to teach me something that freshmeat already has info on.");
@@ -61,6 +62,35 @@ sub update {
        }
     }
 
+    # factoid arguments handler.
+    if (&IsChanConf("factoidArguments") 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: /;
+       while ($lhs =~ s/\$(\S+)/(.*?)/) {
+           push(@list, "\$$1");
+           $count++;
+           last if ($count >= 10);
+       }
+
+       if ($count >= 10) {
+           &msg($who, "error: could not SAR properly.");
+           &DEBUG("error: lhs => '$lhs'.");
+           &DEBUG("error: rhs => '$rhs'.");
+           return;
+       }
+
+       my $z = join(',',@list);
+       $rhs =~ s/^/($z): /;
+
+       &status("Update: new  lhs => '$lhs'.");
+       &status("Update: new  rhs => '$rhs'.");
+    }
+
     # the fun begins.
     my $exists = &getFactoid($lhs);