From 87e3751b3cbfc0de98a0b0b2dd44943e696b9eb9 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Mon, 24 Jul 2006 19:02:37 +0000 Subject: [PATCH 1/1] RSS plugin update. * Less spammy formatting default for trac entries * debug line inspecting the item to be formatted * to_s and to_a methods for RssBlob --- data/rbot/plugins/rss.rb | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/data/rbot/plugins/rss.rb b/data/rbot/plugins/rss.rb index eaa86505..af790127 100644 --- a/data/rbot/plugins/rss.rb +++ b/data/rbot/plugins/rss.rb @@ -69,9 +69,18 @@ class ::RssBlob @watchers.delete(who) end - # def to_ary - # [@handle,@url,@type,@watchers] - # end + def to_a + [@handle,@url,@type,@watchers] + end + + def to_s(watchers=false) + if watchers + a = self.to_a.flatten + else + a = self.to_a[0,3] + end + a.join(" | ") + end end class RSSFeedsPlugin < Plugin @@ -392,6 +401,7 @@ class RSSFeedsPlugin < Plugin end def printFormattedRss(feed, item) + debug "Printing formatted item #{item.inspect} for feed #{feed.to_s}" feed.watchers.each { |loc| case feed.type when 'blog' @@ -404,9 +414,8 @@ class RSSFeedsPlugin < Plugin when 'gmame' @bot.say loc, "::#{feed.handle}:: Message #{item.title} sent by #{item.dc_creator}. #{item.description.split("\n")[0].chomp.riphtml.shorten(@bot.config['rss.text_max'])} ::" when 'trac' - @bot.say loc, "/---- #{feed.handle} :: #{item.title} :: #{item.link}" - @bot.say loc, "|#{item.description.gsub(/\s+/,' ').strip.riphtml.shorten(@bot.config['rss.text_max'])}" - @bot.say loc, "\\----" + @bot.say loc, "::#{feed.handle}:: #{item.title} :: #{item.link}" + @bot.say loc, "::#{feed.handle}:: #{item.description.gsub(/\s+/,' ').strip.riphtml.shorten(@bot.config['rss.text_max'])}" else printRssItem(loc,item) end -- 2.39.2