]> git.donarmstrong.com Git - infobot.git/commitdiff
-> slashdot, should really use rss now...
authortimriker <timriker@c11ca15a-4712-0410-83d8-924469b57eb5>
Tue, 23 Nov 2004 05:16:45 +0000 (05:16 +0000)
committertimriker <timriker@c11ca15a-4712-0410-83d8-924469b57eb5>
Tue, 23 Nov 2004 05:16:45 +0000 (05:16 +0000)
git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk/blootbot@1065 c11ca15a-4712-0410-83d8-924469b57eb5

src/CommandStubs.pl
src/Modules/Slashdot3.pl [deleted file]
src/Modules/slashdot.pl [new file with mode: 0644]
src/modules.pl

index b230798d595c8b9439e361d1712a4f334b65802f..1cc01591c48662e379b3ad62d06e2e5940c68f27 100644 (file)
@@ -216,7 +216,7 @@ sub parseCmdHook {
        'Forker' => 1, 'Cmdstats' => 'Dict') );
 &addCmdHook("extra", 'slashdot', ('CODEREF' => 'Slashdot::Slashdot',
        'Identifier' => 'slashdot', 'Forker' => 1,
-       'Cmdstats' => 'Slashdot') );
+       'Cmdstats' => 'slashdot') );
 &addCmdHook("extra", 'Plug', ('CODEREF' => 'Plug::Plug',
        'Identifier' => 'Plug', 'Forker' => 1,
        'Cmdstats' => 'Plug') );
diff --git a/src/Modules/Slashdot3.pl b/src/Modules/Slashdot3.pl
deleted file mode 100644 (file)
index 7b94b09..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-#
-# Slashdot.pl: Slashdot headline retrival
-#      Author: Chris Tessone <tessone@imsa.edu>
-#    Modified: dms
-#   Licensing: Artistic License (as perl itself)
-#     Version: v0.4 (19991125)
-#
-
-###
-# fixed up to use XML'd /. backdoor 7/31 by richardh@rahga.com
-# My only request if this gets included in infobot is that the
-# other header gets trimmed to 2 lines, dump the fluff ;) -rah
-#
-# added a status message so people know to install LWP - oznoid
-# also simplified the return code because it wasn't working.
-###
-
-package Slashdot;
-
-use strict;
-
-sub slashdotParse {
-    my @list;
-
-    foreach (@_) {
-       next unless (/<title>(.*?)<\/title>/);
-       my $title = $1;
-       $title =~ s/&amp\;/&/g;
-       push(@list, $title);
-    }
-
-    return @list;
-}
-
-sub Slashdot {
-    my @results = &::getURL("http://slashdot.org/slashdot.xml");
-    my $retval  = "i could not get the headlines.";
-
-    if (scalar @results) {
-       my $prefix      = "Slashdot Headlines ";
-       my @list        = &slashdotParse(@results);
-       $retval         = &::formListReply(0, $prefix, @list);
-    }
-
-    &::performStrictReply($retval);
-}
-
-sub slashdotAnnounce {
-    my $file = "$::param{tempDir}/slashdot.xml";
-
-    my @Cxml = &::getURL("http://slashdot.org/slashdot.xml");
-    if (!scalar @Cxml) {
-       &::DEBUG("sdA: failure (Cxml == NULL).");
-       return;
-    }
-
-    if (! -e $file) {          # first time run.
-       open(OUT, ">$file");
-       foreach (@Cxml) {
-           print OUT "$_\n";
-       }
-       close OUT;
-
-       return;
-    }
-
-    my @Oxml;
-    open(IN, $file);
-    while (<IN>) {
-       chop;
-       push(@Oxml,$_);
-    }
-    close IN;
-
-    my @Chl = &slashdotParse(@Cxml);
-    my @Ohl = &slashdotParse(@Oxml);
-
-    my @new;
-    foreach (@Chl) {
-       last if ($_ eq $Ohl[0]);
-       push(@new, $_);
-    }
-
-    if (scalar @new == 0) {
-       &::status("Slashdot: no new headlines.");
-       return;
-    }
-
-    if (scalar @new == scalar @Chl) {
-       &::DEBUG("sdA: scalar(new) == scalar(Chl). bad?");
-    }
-
-    open(OUT,">$file");
-    foreach (@Cxml) {
-       print OUT "$_\n";
-    }
-    close OUT;
-
-    return "Slashdot: News for nerds, stuff that matters -- ".
-                       join(" \002::\002 ", @new);
-}
-
-1;
diff --git a/src/Modules/slashdot.pl b/src/Modules/slashdot.pl
new file mode 100644 (file)
index 0000000..7b94b09
--- /dev/null
@@ -0,0 +1,103 @@
+#
+# Slashdot.pl: Slashdot headline retrival
+#      Author: Chris Tessone <tessone@imsa.edu>
+#    Modified: dms
+#   Licensing: Artistic License (as perl itself)
+#     Version: v0.4 (19991125)
+#
+
+###
+# fixed up to use XML'd /. backdoor 7/31 by richardh@rahga.com
+# My only request if this gets included in infobot is that the
+# other header gets trimmed to 2 lines, dump the fluff ;) -rah
+#
+# added a status message so people know to install LWP - oznoid
+# also simplified the return code because it wasn't working.
+###
+
+package Slashdot;
+
+use strict;
+
+sub slashdotParse {
+    my @list;
+
+    foreach (@_) {
+       next unless (/<title>(.*?)<\/title>/);
+       my $title = $1;
+       $title =~ s/&amp\;/&/g;
+       push(@list, $title);
+    }
+
+    return @list;
+}
+
+sub Slashdot {
+    my @results = &::getURL("http://slashdot.org/slashdot.xml");
+    my $retval  = "i could not get the headlines.";
+
+    if (scalar @results) {
+       my $prefix      = "Slashdot Headlines ";
+       my @list        = &slashdotParse(@results);
+       $retval         = &::formListReply(0, $prefix, @list);
+    }
+
+    &::performStrictReply($retval);
+}
+
+sub slashdotAnnounce {
+    my $file = "$::param{tempDir}/slashdot.xml";
+
+    my @Cxml = &::getURL("http://slashdot.org/slashdot.xml");
+    if (!scalar @Cxml) {
+       &::DEBUG("sdA: failure (Cxml == NULL).");
+       return;
+    }
+
+    if (! -e $file) {          # first time run.
+       open(OUT, ">$file");
+       foreach (@Cxml) {
+           print OUT "$_\n";
+       }
+       close OUT;
+
+       return;
+    }
+
+    my @Oxml;
+    open(IN, $file);
+    while (<IN>) {
+       chop;
+       push(@Oxml,$_);
+    }
+    close IN;
+
+    my @Chl = &slashdotParse(@Cxml);
+    my @Ohl = &slashdotParse(@Oxml);
+
+    my @new;
+    foreach (@Chl) {
+       last if ($_ eq $Ohl[0]);
+       push(@new, $_);
+    }
+
+    if (scalar @new == 0) {
+       &::status("Slashdot: no new headlines.");
+       return;
+    }
+
+    if (scalar @new == scalar @Chl) {
+       &::DEBUG("sdA: scalar(new) == scalar(Chl). bad?");
+    }
+
+    open(OUT,">$file");
+    foreach (@Cxml) {
+       print OUT "$_\n";
+    }
+    close OUT;
+
+    return "Slashdot: News for nerds, stuff that matters -- ".
+                       join(" \002::\002 ", @new);
+}
+
+1;
index 2ff267b79c2db6a5fe9f2a66f0600e564dc74740..5ab42ea9f081c98318a7f58c1f6ce889cf95be6f 100644 (file)
@@ -45,7 +45,7 @@ if ($@) {
        "RootWarn"      => "RootWarn.pl",
        "Rss"           => "Rss.pl",
        "Search"        => "Search.pl",
-       "slashdot"      => "Slashdot3.pl",
+       "slashdot"      => "slashdot.pl",
        "symdump"       => "DumpVars2.pl",
        "topic"         => "Topic.pl",
        "units"         => "Units.pl",