]> git.donarmstrong.com Git - infobot.git/commitdiff
initial generic rss module
authortimriker <timriker@c11ca15a-4712-0410-83d8-924469b57eb5>
Wed, 23 Jun 2004 19:31:05 +0000 (19:31 +0000)
committertimriker <timriker@c11ca15a-4712-0410-83d8-924469b57eb5>
Wed, 23 Jun 2004 19:31:05 +0000 (19:31 +0000)
git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk/blootbot@958 c11ca15a-4712-0410-83d8-924469b57eb5

src/CommandStubs.pl
src/Modules/Rss.pl [new file with mode: 0644]
src/dbi.pl
src/modules.pl

index 6bf5cc0200619b1c59493d7085e2e5ce970904db..ef6e7544103e08cdaabc206005f1be2a923a4a37 100644 (file)
@@ -255,7 +255,9 @@ sub parseCmdHook {
 &addCmdHook("extra", 'httpdtype', ('CODEREF' => 'HTTPDtype::HTTPDtype',
        'Identifier' => 'httpdtype', 'Cmdstats' => 'httpdtype',
        'Forker' => 1) );
-
+&addCmdHook("extra", 'rss', ('CODEREF' => 'Rss::Rss',
+       'Identifier' => 'rss', 'Cmdstats' => 'rss',
+       'Forker' => 1, 'Help' => 'rss') );
 ###
 ### END OF ADDING HOOKS.
 ###
diff --git a/src/Modules/Rss.pl b/src/Modules/Rss.pl
new file mode 100644 (file)
index 0000000..153d07e
--- /dev/null
@@ -0,0 +1,40 @@
+#
+#     Rss.pl: rss handler hacked from Plug.pl
+#     Author: Tim Riker <Tim@Rikers.org>
+#  Licensing: Artistic License (as perl itself)
+#    Version: v0.1
+#
+
+package Rss;
+
+use strict;
+
+sub Rss::Titles {
+       my @list;
+
+       foreach (@_) {
+               next unless (/<title>(.*?)<\/title>/);
+               my $title = $1;
+               $title =~ s/&amp\;/&/g;
+               push(@list, $title);
+       }
+
+       return @list;
+}
+
+sub Rss::Rss {
+       my ($message) = @_;
+       my @results = &::getURL($message);
+       my $retval  = "i could not get the rss feed.";
+
+       if (scalar @results) {
+               my $prefix      = "Titles: ";
+               my @list        = &Rss::Titles(@results);
+               $retval         = &::formListReply(0, $prefix, @list);
+       }
+
+       &::performStrictReply($retval);
+}
+
+1;
+# vim: ts=2 sw=2
index f5565539924fc0eefa1dc70711de4be974384f72..b0abee1123faf984528142782e61edbf9b1d3f0e 100644 (file)
@@ -636,7 +636,7 @@ sub checkTables {
        # create database not needed for SQLite
     }
 
-    foreach ( qw(botmail factoids rootwarn seen stats) ) {
+    foreach ( qw(botmail connections factoids rootwarn seen stats) ) {
        if (exists $db{$_}) {
            $cache{has_table}{$_} = 1;
            next;
index a86900ce5b6ece808487537e665d392d9a5c5faf..ce0b5b23b9f5d9ea0f84bf971c5c961980dcb626 100644 (file)
@@ -22,40 +22,41 @@ if ($@) {
 
 ### MODULES.
 %myModules = (
+       "babelfish"     => "babel.pl",
+       "botmail"       => "botmail.pl",
        "bzflag"        => "BZFlag.pl",
        "countdown"     => "Countdown.pl",
        "debian"        => "Debian.pl",
        "debianExtra"   => "DebianExtra.pl",
        "dict"          => "Dict.pl",
        "dumpvars"      => "DumpVars.pl",
-       "symdump"       => "DumpVars2.pl",
        "exchange"      => "Exchange.pl",
        "factoids"      => "Factoids.pl",
+       "httpdtype"     => "HTTPDtype.pl",
+       "insult"        => "insult.pl",
+       "ircdcc"        => "UserDCC.pl",
        "kernel"        => "Kernel.pl",
-       "perlMath"      => "Math.pl",
        "news"          => "News.pl",
+       "nickometer"    => "nickometer.pl",
+       "perlMath"      => "Math.pl",
        "plug"          => "Plug.pl",
        "quote"         => "Quote.pl",
        "rootwarn"      => "RootWarn.pl",
+       "rss"           => "Rss.pl",
        "search"        => "Search.pl",
        "slashdot"      => "Slashdot3.pl",
+       "symdump"       => "DumpVars2.pl",
        "topic"         => "Topic.pl",
        "units"         => "Units.pl",
        "uptime"        => "Uptime.pl",
-       "ircdcc"        => "UserDCC.pl",
        "userinfo"      => "UserInfo.pl",
        "weather"       => "Weather.pl",
-       "wwwsearch"     => "W3Search.pl",
        "whatis"        => "WhatIs.pl",
        "wingate"       => "Wingate.pl",
-       "babelfish"     => "babel.pl",
-       "insult"        => "insult.pl",
-       "nickometer"    => "nickometer.pl",
+       "wwwsearch"     => "W3Search.pl",
        "zfi"           => "zfi.pl",
        "zippy"         => "Zippy.pl",
        "zsi"           => "zsi.pl",
-       "botmail"       => "botmail.pl",
-       "httpdtype"     => "HTTPDtype.pl",
 );
 ### THIS IS NOT LOADED ON RELOAD :(
 my @myModulesLoadNow;