From 8fdc4283433cf3e8969e728dbd3f17b3da63d65a Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Sat, 15 Sep 2007 10:35:34 +0000 Subject: 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 --- data/rbot/plugins/rss.rb | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'data/rbot/plugins') 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 -- cgit v1.2.3