2 # Slashdot.pl: Slashdot headline retrival
3 # Author: Chris Tessone <tessone@imsa.edu>
5 # Licensing: Artistic License (as perl itself)
6 # Version: v0.4 (19991125)
10 # fixed up to use XML'd /. backdoor 7/31 by richardh@rahga.com
11 # My only request if this gets included in infobot is that the
12 # other header gets trimmed to 2 lines, dump the fluff ;) -rah
14 # added a status message so people know to install LWP - oznoid
15 # also simplified the return code because it wasn't working.
26 next unless (/<title>(.*?)<\/title>/);
28 $title =~ s/&\;/&/g;
36 my @results = &main::getURL("http://www.slashdot.org/slashdot.xml");
37 my $retval = "i could not get the headlines.";
39 if (scalar @results) {
40 my $prefix = "Slashdot Headlines ";
41 my @list = &slashdotParse(@results);
42 $retval = &main::formListReply(0, $prefix, @list);
45 &main::performStrictReply($retval);
48 sub slashdotAnnounce {
49 my $file = "Temp/slashdot.xml";
51 &main::DEBUG("sdA: mking dir.");
55 my @Cxml = &main::getURL("http://www.slashdot.org/slashdot.xml");
57 &main::DEBUG("sdA: failure (Cxml == NULL).");
61 if (! -e $file) { # first time run.
79 my @Chl = &slashdotParse(@Cxml);
80 my @Ohl = &slashdotParse(@Oxml);
84 last if ($_ eq $Ohl[0]);
88 if (scalar @new == 0) {
89 &main::status("Slashdot: no new headlines.");
93 if (scalar @new == scalar @Chl) {
94 &main::DEBUG("sdA: scalar(new) == scalar(Chl). bad?");
103 my $line = "Slashdot: News for nerds, stuff that matters -- ".
104 join(" \002::\002 ", @new);
106 my @chans = split(/[\s\t]+/, lc $main::param{'slashdotAnnounce'});
107 @chans = keys(%main::channels) unless (scalar @chans);
109 next unless (&main::validChan($_));
111 &main::status("sending slashdot update to $_.");
112 &main::notice($_, $line);
114 sleep 1; # just in case?