]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - data/rbot/plugins/rss.rb
rss plugin: strip whitespace from link, category and author
[user/henk/code/ruby/rbot.git] / data / rbot / plugins / rss.rb
index fea6f352697df67d7ce8836a261eade8dce00a0c..77d897cab6b9d2d0edb28f1c9b975269aececca9 100644 (file)
@@ -259,7 +259,8 @@ class RSSFeedsPlugin < Plugin
   # only the guid/link is accounted for.
   
   def block_rescue(df = nil, &block)
-    block.call rescue nil
+    v = block.call rescue nil
+    (String === v && '' != v) ? v : nil
   end
 
   def make_uid(item)
@@ -280,6 +281,7 @@ class RSSFeedsPlugin < Plugin
         block_rescue do item.title end
       )
     end
+    # debug "taking hash of #{uid.inspect}"
     uid.hash
   end
 
@@ -1033,10 +1035,13 @@ class RSSFeedsPlugin < Plugin
       desc = "(?)"
     end
 
-    link = item.link.href rescue item.link.chomp rescue nil
+    link = item.link.href rescue item.link rescue nil
+    link.strip! if link
 
     category = select_nonempty((item.category.content rescue nil), (item.dc_subject rescue nil))
+    category.strip! if category
     author = select_nonempty((item.author.name.content rescue nil), (item.dc_creator rescue nil), (item.author rescue nil))
+    author.strip! if author
 
     line1 = nil
     line2 = nil