diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2008-02-13 17:28:04 +0100 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2008-02-13 17:28:04 +0100 |
commit | bdf0e7769fde6ed0a25c56906bb1d29db199fda3 (patch) | |
tree | 6de1c453633c29ea1b381b80caed99ad0198a443 /data | |
parent | 787d368e9fb6bc0ed972d5825769d598d45d1ca4 (diff) |
rss plugin: support git commits in trac
Since git changes are identified by their SHA1, they get too long in titles.
So we just clip that part out, as it's available in the link anyway.
Diffstat (limited to 'data')
-rw-r--r-- | data/rbot/plugins/rss.rb | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/data/rbot/plugins/rss.rb b/data/rbot/plugins/rss.rb index 1da488c3..5e854239 100644 --- a/data/rbot/plugins/rss.rb +++ b/data/rbot/plugins/rss.rb @@ -863,7 +863,14 @@ class RSSFeedsPlugin < Plugin # limit to 160 characters, and most of them are under 140 characters
tit_opt[:limit] = @bot.config['rss.head_max'] unless feed.type == 'twitter'
- title = "#{Bold}#{item.title.to_s.ircify_html(tit_opt)}#{Bold}" if item.title
+ if item.title
+ base_title = item.title.to_s.dup
+ # git changesets are SHA1 hashes (40 hex digits), way too long, get rid of them, as they are
+ # visible in the URL anyway
+ # TODO make this optional?
+ base_title.sub!(/^Changeset \[([\da-f]{40})\]/) { |c| "Changeset [...]"} if feed.type = 'trac'
+ title = "#{Bold}#{base_title.ircify_html(tit_opt)}#{Bold}"
+ end
desc_opt = {
:limit => @bot.config['rss.text_max'],
@@ -910,7 +917,7 @@ class RSSFeedsPlugin < Plugin line1 = "#{handle}#{date}Message #{title} sent by #{author}. #{desc}"
when 'trac'
line1 = "#{handle}#{date}#{title} @ #{link}"
- unless item.title =~ /^Changeset \[(\d+)\]/
+ unless item.title =~ /^Changeset \[(?:[\da-f]+|\.\.\.)\]/
line2 = "#{handle}#{date}#{desc}"
end
when '/.'
|