]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
rss: updated can be nil
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Tue, 11 Jan 2011 10:35:59 +0000 (11:35 +0100)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Tue, 11 Jan 2011 10:35:59 +0000 (11:35 +0100)
An Atom item can reply to updated even though its value is nil, so
check for it actually being valued instead. Also, some malformed Atom
feeds use the nonstandard 'modified' element instead, so check for that
too.

data/rbot/plugins/rss.rb

index eb3fa5f86b1bcb60be626006f323b91ac1341a14..03e54140fe7d5ab6506db4a675dc4f9ccf67686c 100644 (file)
@@ -1079,8 +1079,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)