From: timriker Date: Wed, 23 Jun 2004 19:31:05 +0000 (+0000) Subject: initial generic rss module X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=e0a18d5693fd5edeb0664b7cc35ccf0a2d5a4671;p=infobot.git initial generic rss module git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk@958 c11ca15a-4712-0410-83d8-924469b57eb5 --- diff --git a/blootbot/src/CommandStubs.pl b/blootbot/src/CommandStubs.pl index 6bf5cc0..ef6e754 100644 --- a/blootbot/src/CommandStubs.pl +++ b/blootbot/src/CommandStubs.pl @@ -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/blootbot/src/Modules/Rss.pl b/blootbot/src/Modules/Rss.pl new file mode 100644 index 0000000..153d07e --- /dev/null +++ b/blootbot/src/Modules/Rss.pl @@ -0,0 +1,40 @@ +# +# Rss.pl: rss handler hacked from Plug.pl +# Author: Tim Riker +# Licensing: Artistic License (as perl itself) +# Version: v0.1 +# + +package Rss; + +use strict; + +sub Rss::Titles { + my @list; + + foreach (@_) { + next unless (/(.*?)<\/title>/); + my $title = $1; + $title =~ s/&\;/&/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 diff --git a/blootbot/src/dbi.pl b/blootbot/src/dbi.pl index f556553..b0abee1 100644 --- a/blootbot/src/dbi.pl +++ b/blootbot/src/dbi.pl @@ -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; diff --git a/blootbot/src/modules.pl b/blootbot/src/modules.pl index a86900c..ce0b5b2 100644 --- a/blootbot/src/modules.pl +++ b/blootbot/src/modules.pl @@ -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;