summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-09-15 10:35:34 +0000
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-09-15 10:35:34 +0000
commit8fdc4283433cf3e8969e728dbd3f17b3da63d65a (patch)
treea174c59b9846872c2cd63accb97879d54c878fef
parentfc6aed71f513c83f0ae6aee74cc8410f0c4af0a9 (diff)
rss plugin: add support for twitter format
Twitter feeds can use the generic output format, but there is no need to 'cap' their titles because of the hardcoded length limits imposed by Twitter
-rw-r--r--data/rbot/plugins/rss.rb13
1 files changed, 11 insertions, 2 deletions
diff --git a/data/rbot/plugins/rss.rb b/data/rbot/plugins/rss.rb
index 5e7eff21..22aa742f 100644
--- a/data/rbot/plugins/rss.rb
+++ b/data/rbot/plugins/rss.rb
@@ -815,9 +815,18 @@ class RSSFeedsPlugin < Plugin
end
end
- title = "#{Bold}#{item.title.ircify_html :limit => @bot.config['rss.head_max']}#{Bold}" if item.title
+ tit_opt = {}
+ # Twitters don't need a cap on the title length since they have a hard
+ # limit to 160 characters, and most of them are under 140 characters
+ tit_opt[:limit] = @bot.config['rss.head_max'] unless feed.type == 'twitter'
- desc = item.description.ircify_html(:limit => @bot.config['rss.text_max'], :a_href => :link_out) if item.description
+ title = "#{Bold}#{item.title.ircify_html(tit_opt)}#{Bold}" if item.title
+
+ desc_opt = {
+ :limit => @bot.config['rss.text_max'],
+ :a_href => :link_out
+ }
+ desc = item.description.ircify_html(desc_opt) if item.description
link = item.link.chomp if item.link