]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
rss plugin: fix bugs with category retrieval and author display
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Sat, 14 Apr 2007 08:41:45 +0000 (08:41 +0000)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Sat, 14 Apr 2007 08:41:45 +0000 (08:41 +0000)
data/rbot/plugins/rss.rb

index 22b562955fcc34f0a41d38a77a89da5743d0da70..e0d4df01747b4b6ccf77049133c62d9d22f20e0b 100644 (file)
@@ -16,8 +16,6 @@
 \r
 require 'rss'\r
 \r
-# Add support for Slashdot namespace in RDF. The code is just an adaptation of\r
-# the DublinCore code.\r
 module ::RSS\r
 \r
   # Make an  'unique' ID for a given item, based on appropriate bot options\r
@@ -30,6 +28,8 @@ module ::RSS
     [item.title, item.link, desc].hash\r
   end\r
 \r
+  # Add support for Slashdot namespace in RDF. The code is just an adaptation\r
+  # of the DublinCore code.\r
   unless defined?(SLASH_PREFIX)\r
     SLASH_PREFIX = 'slash'\r
     SLASH_URI = "http://purl.org/rss/1.0/modules/slash/"\r
@@ -785,8 +785,10 @@ class RSSFeedsPlugin < Plugin
     link = item.link.chomp if item.link\r
 \r
     debug item.inspect\r
-    category = item.dc_subject rescue item.category rescue nil\r
+    category = item.dc_subject rescue item.category.content rescue nil\r
+    category = nil if category and category.empty?\r
     author = item.dc_creator rescue item.author rescue nil\r
+    author = nil if author and author.empty?\r
 \r
     line1 = nil\r
     line2 = nil\r
@@ -794,8 +796,9 @@ class RSSFeedsPlugin < Plugin
     at = ((item.title && item.link) ? ' @ ' : '')\r
     case feed.type\r
     when 'blog'\r
+      author << " " if author\r
       abt = category ? "about #{category} " : ""\r
-      line1 = "#{handle}#{date}#{author} blogged #{abt}at #{link}"\r
+      line1 = "#{handle}#{date}#{author}blogged #{abt}at #{link}"\r
       line2 = "#{handle}#{title} - #{desc}"\r
     when 'forum'\r
       line1 = "#{handle}#{date}#{title}#{at}#{link}"\r