]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - data/rbot/plugins/rss.rb
factoids plugin: actually output metadata in long form of Factoid#to_s
[user/henk/code/ruby/rbot.git] / data / rbot / plugins / rss.rb
index 5a87e7893cdf19c59b25a70df9dd29ab293ab8cd..22aa742ff6bc3c08f98a1020123f9c8e19ace2f2 100644 (file)
@@ -283,15 +283,15 @@ class RSSFeedsPlugin < Plugin
       # the restore to work.\r
       #\r
       # This is actually pretty safe for a number of reasons:\r
-      #  * the code is only called if standard marshalling fails\r
-      #  * the string we look for is quite unlikely to appear randomly\r
-      #  * if the string appears somewhere and the patched string isn't recoverable\r
-      #    either, we'll get another (unrecoverable) error, which makes the rss\r
-      #    plugin unsable, just like it was if no recovery was attempted\r
-      #  * if the string appears somewhere and the patched string is recoverable,\r
-      #    we may get a b0rked feed, which is eventually overwritten by a clean\r
-      #    one, so the worst thing that can happen is that a feed update spams\r
-      #    the watchers once\r
+      # * the code is only called if standard marshalling fails\r
+      # * the string we look for is quite unlikely to appear randomly\r
+      # * if the string appears somewhere and the patched string isn't recoverable\r
+      #   either, we'll get another (unrecoverable) error, which makes the rss\r
+      #   plugin unsable, just like it was if no recovery was attempted\r
+      # * if the string appears somewhere and the patched string is recoverable,\r
+      #   we may get a b0rked feed, which is eventually overwritten by a clean\r
+      #   one, so the worst thing that can happen is that a feed update spams\r
+      #   the watchers once\r
       @registry.recovery = Proc.new { |val|\r
         patched = val.sub(":\v@mutexo:\nMutex", ":\v@mutexo:\vObject")\r
         ret = Marshal.restore(patched)\r
@@ -815,9 +815,18 @@ class RSSFeedsPlugin < Plugin
       end\r
     end\r
 \r
-    title = "#{Bold}#{item.title.ircify_html :limit => @bot.config['rss.head_max']}#{Bold}" if item.title\r
+    tit_opt = {}\r
+    # Twitters don't need a cap on the title length since they have a hard\r
+    # limit to 160 characters, and most of them are under 140 characters\r
+    tit_opt[:limit] = @bot.config['rss.head_max'] unless feed.type == 'twitter'\r
 \r
-    desc = item.description.ircify_html(:limit => @bot.config['rss.text_max'], :a_href => :link_out) if item.description\r
+    title = "#{Bold}#{item.title.ircify_html(tit_opt)}#{Bold}" if item.title\r
+\r
+    desc_opt = {\r
+      :limit => @bot.config['rss.text_max'],\r
+      :a_href => :link_out\r
+    }\r
+    desc = item.description.ircify_html(desc_opt) if item.description\r
 \r
     link = item.link.chomp if item.link\r
 \r