summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/rbot/plugins/rss.rb8
-rw-r--r--lib/rbot/core/utils/extends.rb10
2 files changed, 11 insertions, 7 deletions
diff --git a/data/rbot/plugins/rss.rb b/data/rbot/plugins/rss.rb
index e0d4df01..faf26049 100644
--- a/data/rbot/plugins/rss.rb
+++ b/data/rbot/plugins/rss.rb
@@ -230,11 +230,11 @@ end
class RSSFeedsPlugin < Plugin
BotConfig.register BotConfigIntegerValue.new('rss.head_max',
- :default => 30, :validate => Proc.new{|v| v > 0 && v < 200},
+ :default => 100, :validate => Proc.new{|v| v > 0 && v < 200},
:desc => "How many characters to use of a RSS item header")
BotConfig.register BotConfigIntegerValue.new('rss.text_max',
- :default => 90, :validate => Proc.new{|v| v > 0 && v < 400},
+ :default => 200, :validate => Proc.new{|v| v > 0 && v < 400},
:desc => "How many characters to use of a RSS item text")
BotConfig.register BotConfigIntegerValue.new('rss.thread_sleep',
@@ -778,9 +778,9 @@ class RSSFeedsPlugin < Plugin
end
end
- title = "#{Bold}#{item.title.ircify_html}#{Bold}" if item.title
+ title = "#{Bold}#{item.title.ircify_html :limit => @bot.config['rss.head_max']}#{Bold}" if item.title
- desc = item.description.ircify_html(:a_href => :link_out) if item.description
+ desc = item.description.ircify_html(:limit => @bot.config['rss.text_max'], :a_href => :link_out) if item.description
link = item.link.chomp if item.link
diff --git a/lib/rbot/core/utils/extends.rb b/lib/rbot/core/utils/extends.rb
index 1aa6d457..80bad383 100644
--- a/lib/rbot/core/utils/extends.rb
+++ b/lib/rbot/core/utils/extends.rb
@@ -85,8 +85,7 @@ end
# 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
@@ -156,9 +155,14 @@ 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