X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=data%2Frbot%2Fplugins%2Frss.rb;h=22aa742ff6bc3c08f98a1020123f9c8e19ace2f2;hb=b0c7f5f17b65043a796f8b3f4dc27cbfa287e087;hp=5a87e7893cdf19c59b25a70df9dd29ab293ab8cd;hpb=6f5528a63b44e610a3d25d7fe583399163d7d2da;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git diff --git a/data/rbot/plugins/rss.rb b/data/rbot/plugins/rss.rb index 5a87e789..22aa742f 100644 --- a/data/rbot/plugins/rss.rb +++ b/data/rbot/plugins/rss.rb @@ -283,15 +283,15 @@ class RSSFeedsPlugin < Plugin # the restore to work. # # This is actually pretty safe for a number of reasons: - # * the code is only called if standard marshalling fails - # * the string we look for is quite unlikely to appear randomly - # * if the string appears somewhere and the patched string isn't recoverable - # either, we'll get another (unrecoverable) error, which makes the rss - # plugin unsable, just like it was if no recovery was attempted - # * if the string appears somewhere and the patched string is recoverable, - # we may get a b0rked feed, which is eventually overwritten by a clean - # one, so the worst thing that can happen is that a feed update spams - # the watchers once + # * the code is only called if standard marshalling fails + # * the string we look for is quite unlikely to appear randomly + # * if the string appears somewhere and the patched string isn't recoverable + # either, we'll get another (unrecoverable) error, which makes the rss + # plugin unsable, just like it was if no recovery was attempted + # * if the string appears somewhere and the patched string is recoverable, + # we may get a b0rked feed, which is eventually overwritten by a clean + # one, so the worst thing that can happen is that a feed update spams + # the watchers once @registry.recovery = Proc.new { |val| patched = val.sub(":\v@mutexo:\nMutex", ":\v@mutexo:\vObject") ret = Marshal.restore(patched) @@ -815,9 +815,18 @@ class RSSFeedsPlugin < Plugin end end - title = "#{Bold}#{item.title.ircify_html :limit => @bot.config['rss.head_max']}#{Bold}" if item.title + tit_opt = {} + # Twitters don't need a cap on the title length since they have a hard + # limit to 160 characters, and most of them are under 140 characters + tit_opt[:limit] = @bot.config['rss.head_max'] unless feed.type == 'twitter' - desc = item.description.ircify_html(:limit => @bot.config['rss.text_max'], :a_href => :link_out) if item.description + title = "#{Bold}#{item.title.ircify_html(tit_opt)}#{Bold}" if item.title + + desc_opt = { + :limit => @bot.config['rss.text_max'], + :a_href => :link_out + } + desc = item.description.ircify_html(desc_opt) if item.description link = item.link.chomp if item.link