diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2006-07-24 19:02:37 +0000 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2006-07-24 19:02:37 +0000 |
commit | 87e3751b3cbfc0de98a0b0b2dd44943e696b9eb9 (patch) | |
tree | 4bb4cbf13c333ae9ad86cd5e50d521865086fdf3 /data | |
parent | 9d8c71c9ecaf7be690d37b699deedcf59de6096e (diff) |
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
Diffstat (limited to 'data')
-rw-r--r-- | data/rbot/plugins/rss.rb | 21 |
1 files 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
|