X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=data%2Frbot%2Fplugins%2Frss.rb;h=b2d367b0da645a4f1e4b61ad9f60712768513853;hb=052217de30c59206d7025b582d4604557a747470;hp=eb3fa5f86b1bcb60be626006f323b91ac1341a14;hpb=a95675a1961cb5c205ba997c9f0599f453b19d4a;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git diff --git a/data/rbot/plugins/rss.rb b/data/rbot/plugins/rss.rb index eb3fa5f8..b2d367b0 100644 --- a/data/rbot/plugins/rss.rb +++ b/data/rbot/plugins/rss.rb @@ -151,6 +151,28 @@ module ::RSS SlashModel::ELEMENTS.collect! {|name| "#{SLASH_PREFIX}_#{name}"} end + if self.const_defined? :Atom + # There are improper Atom feeds around that use the non-standard + # 'modified' element instead of the correct 'updated' one. Let's + # support it too. + module Atom + class Feed + class Modified < RSS::Element + include CommonModel + include DateConstruct + end + __send__("install_have_child_element", + "modified", URI, nil, "modified", :content) + + class Entry + Modified = Feed::Modified + __send__("install_have_child_element", + "modified", URI, nil, "modified", :content) + end + end + end + end + class Element class << self def def_bang(name, chain) @@ -309,7 +331,7 @@ class RSSFeedsPlugin < Plugin :desc => "Whether to display links from the text of a feed item.") # Make an 'unique' ID for a given item, based on appropriate bot options - # Currently only suppored is bot.config['rss.show_updated']: when false, + # Currently only supported is bot.config['rss.show_updated']: when false, # only the guid/link is accounted for. def make_uid(item) @@ -913,8 +935,8 @@ class RSSFeedsPlugin < Plugin stop_watches # Read watches from list. - watchlist.each{ |handle, feed| - watchRss(feed, m) + watchlist.each{ |hndl, fd| + watchRss(fd, m) } m.okay if m end @@ -1079,8 +1101,10 @@ class RSSFeedsPlugin < Plugin date = \ if opts[:date] - if item.respond_to?(:updated) + if item.respond_to?(:updated) and item.updated make_date(item.updated.content) + elsif item.respond_to?(:modified) and item.modified + make_date(item.modified.content) elsif item.respond_to?(:source) and item.source.respond_to?(:updated) make_date(item.source.updated.content) elsif item.respond_to?(:pubDate)