\r
class RSSFeedsPlugin < Plugin\r
BotConfig.register BotConfigIntegerValue.new('rss.head_max',\r
- :default => 30, :validate => Proc.new{|v| v > 0 && v < 200},\r
+ :default => 100, :validate => Proc.new{|v| v > 0 && v < 200},\r
:desc => "How many characters to use of a RSS item header")\r
\r
BotConfig.register BotConfigIntegerValue.new('rss.text_max',\r
- :default => 90, :validate => Proc.new{|v| v > 0 && v < 400},\r
+ :default => 200, :validate => Proc.new{|v| v > 0 && v < 400},\r
:desc => "How many characters to use of a RSS item text")\r
\r
BotConfig.register BotConfigIntegerValue.new('rss.thread_sleep',\r
end\r
end\r
\r
- title = "#{Bold}#{item.title.ircify_html}#{Bold}" if item.title\r
+ title = "#{Bold}#{item.title.ircify_html :limit => @bot.config['rss.head_max']}#{Bold}" if item.title\r
\r
- desc = item.description.ircify_html(:a_href => :link_out) if item.description\r
+ desc = item.description.ircify_html(:limit => @bot.config['rss.text_max'], :a_href => :link_out) if item.description\r
\r
link = item.link.chomp if item.link\r
\r
# Extensions to the String class
#
-# TODO make ircify_html() accept an Hash of options, and make riphtml() just
-# call ircify_html() with stronger purify options.
+# TODO make riphtml() just call ircify_html() with stronger purify options.
#
class ::String
# And finally whitespace is squeezed
txt.gsub!(/\s+/, ' ')
+ txt.strip!
+
+ if opts[:limit] && txt.size > opts[:limit]
+ txt = txt.slice(0, opts[:limit]) + "#{Reverse}...#{Reverse}"
+ end
# Decode entities and strip whitespace
- return txt.strip
+ return txt
end
# As above, but modify the receiver