diff options
Diffstat (limited to 'lib/helpers.rb')
-rw-r--r-- | lib/helpers.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/helpers.rb b/lib/helpers.rb index 5c3422e..3620d49 100644 --- a/lib/helpers.rb +++ b/lib/helpers.rb @@ -2,6 +2,9 @@ require 'date' require 'rinku' require 'erb' +GMANE_FIND = 'http://news.gmane.org/find-root.php?message_id=' +MARC_FIND = 'https://marc.info/?i=' + helpers do def list_check unless [$config['active_lists'], $config['frozen_lists']].flatten.include?(params[:list]) @@ -68,5 +71,19 @@ helpers do Rinku.auto_link(str, :urls, 'rel="nofollow"') end + def msgid_to_gmane(msgid) + GMANE_FIND + ERB::Util::url_encode(msgid) + end + def msgid_to_marc(msgid) + # We have to transform the msg-id first + # CAK86ViRgefgrb0qUyjQdYa+6C5BTiNvn8UKZwQsMvcJmY-L0mg@mail.gmail.com + # CAK86ViRgefgrb0qUyjQdYa+6C5BTiNvn8UKZwQsMvcJmY-L0mg () mail ! gmail ! com + # http://marc.info/?i=CAK86ViRgefgrb0qUyjQdYa+6C5BTiNvn8UKZwQsMvcJmY-L0mg%20()%20mail%20!%20gmail%20!%20com + # pan.2009.08.28.00.00.38@cox.net + # http://marc.info/?i=pan.2009.08.28.00.00.38%20()%20cox%20!%20net + local, host = msgid.split('@', 2) + new_msgid = local + ' () ' + host.gsub('.',' ! ') + MARC_FIND + ERB::Util::url_encode(new_msgid) + end end |