diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2009-03-15 11:04:24 +0100 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2009-03-15 11:04:24 +0100 |
commit | e51c1c0156538d07d1eb1bf15a334c5164401448 (patch) | |
tree | 27cba2b9b4d18010ac0b21a14502f09176f85265 /data | |
parent | 129f8c4f5678ab4a753ddb8ffb3088835d17d4d4 (diff) |
rss: configurable announce method
Since the RSS update announcements do not expect any form of reply,
they could be considered the typical IRC message that should use
NOTICE rather than PRIVMSG.
However, for backwards compatibility and since NOTICEs are not always
appreciated (and since their handling from clients is not always
optimal, either), we still allow rss announces to use the traditional
method, and that is in fact selected as default. Explicit rss show
request always go with PRIVMSG.
Diffstat (limited to 'data')
-rw-r--r-- | data/rbot/plugins/rss.rb | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/data/rbot/plugins/rss.rb b/data/rbot/plugins/rss.rb index dcd50b57..8004cb12 100644 --- a/data/rbot/plugins/rss.rb +++ b/data/rbot/plugins/rss.rb @@ -294,6 +294,11 @@ class RSSFeedsPlugin < Plugin :default => true, :desc => "Whether to display links from the text of a feed item.") + Config.register Config::EnumValue.new('rss.announce_method', + :values => ['say', 'notice'], + :default => 'say', + :desc => "Whether to display links from the text of a feed item.") + # Make an 'unique' ID for a given item, based on appropriate bot options # Currently only suppored is bot.config['rss.show_updated']: when false, # only the guid/link is accounted for. @@ -593,7 +598,12 @@ class RSSFeedsPlugin < Plugin m.reply "Channel : #{title}" disp.each do |item| - printFormattedRss(feed, item, {:places=>[m.replyto],:handle=>nil,:date=>true}) + printFormattedRss(feed, item, { + :places => [m.replyto], + :handle => nil, + :date => true, + :announce_method => :say + }) end end @@ -977,13 +987,16 @@ class RSSFeedsPlugin < Plugin opts = { :places => feed.watchers, :handle => feed.handle.empty? ? "" : "::#{feed.handle}:: ", - :date => false + :date => false, + :announce_method => @bot.config['rss.announce_method'] }.merge options date = String.new places = opts[:places] handle = opts[:handle].to_s + announce_method = opts[:announce_method] + if opts[:date] if item.respond_to?(:updated) if item.updated.content.class <= Time @@ -1076,7 +1089,7 @@ class RSSFeedsPlugin < Plugin places.each { |loc| output.to_s.each_line { |line| - @bot.say loc, line, :overlong => :truncate + @bot.__send__(announce_method, loc, line, :overlong => :truncate) } } end |