]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
rss: obviously, the precending patch wasn't enough
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Tue, 11 Jan 2011 14:17:02 +0000 (15:17 +0100)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Tue, 11 Jan 2011 14:20:34 +0000 (15:20 +0100)
Proper support for a 'modified' element actually requires its model
to be defined and added to the RSS Atom namespace.

data/rbot/plugins/rss.rb

index 03e54140fe7d5ab6506db4a675dc4f9ccf67686c..6b16361984d3d19056e6e2151316558b396da6c8 100644 (file)
@@ -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)