From d7c77db717c8f83c8f018577cae8b4889c5355e3 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Fri, 23 Jan 2009 04:42:34 +0100 Subject: [PATCH] rss plugin: relay missing RssBlob methods to its rss We store the parsed RSS object in the blob, and relay any missing methods to it, or to its channel. This allows things such feeds['somefeed'].generator to work (after parsing). Feed title and items are kept as special cases. --- data/rbot/plugins/rss.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/data/rbot/plugins/rss.rb b/data/rbot/plugins/rss.rb index 86ec0727..e598c154 100644 --- a/data/rbot/plugins/rss.rb +++ b/data/rbot/plugins/rss.rb @@ -155,6 +155,7 @@ end class ::RssBlob attr_accessor :url, :handle, :type, :refresh_rate, :xml, :title, :items, + :rss, :mutex, :watchers, :last_fetched def initialize(url,handle=nil,type=nil,watchers=[], xml=nil, lf = nil) @@ -170,11 +171,22 @@ class ::RssBlob @xml = xml @title = nil @items = nil + @rss = nil @mutex = Mutex.new @last_fetched = lf sanitize_watchers(watchers) end + def method_missing(mth, *args) + if @rss.respond_to? mth + @rss.send(mth, *args) + elsif @rss.respond_to? :channel and @rss.channel.respond_to? mth + @rss.channel.send(mth, *args) + else + super + end + end + def dup @mutex.synchronize do self.class.new(@url, @@ -1162,6 +1174,7 @@ class RSSFeedsPlugin < Plugin end feed.title = title.strip feed.items = items + feed.rss = rss return true end end -- 2.32.0.93.g670b81a890