Colin Bell
2007-Nov-21 04:26 UTC
[sup-talk] [PATCH] New hook to allow formatting of message headers
Hi, This patch allows you to format the headers shown in the Detailed Headers view. Also attached is an example hook which will show the email client and a spam header. -- Col -------------- next part -------------- A non-text attachment was scrubbed... Name: headers.diff Type: application/octet-stream Size: 1193 bytes Desc: not available Url : http://rubyforge.org/pipermail/sup-talk/attachments/20071121/a752531a/attachment.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: format-message-headers.rb Type: application/octet-stream Size: 202 bytes Desc: not available Url : http://rubyforge.org/pipermail/sup-talk/attachments/20071121/a752531a/attachment-0001.obj
William Morgan
2007-Dec-05 18:12 UTC
[sup-talk] [PATCH] New hook to allow formatting of message headers
Hi Colin, Excerpts from Colin Bell''s message of Tue Nov 20 20:26:40 -0800 2007:> This patch allows you to format the headers shown in the Detailed > Headers view. Also attached is an example hook which will show the > email client and a spam header.I''ve applied this to SVN trunk, but (as I am wont to do) I tweaked it a bit. I renamed it "detailed-headers" and changed the arguments so that you get, and return, a hash rather than an array, which I think is a little friendlier. Here''s the new version of your hook: $ cat /detailed-headers.rb ["User-Agent", "X-Mailer", "X-Spam-Status"].map do |key| if message.raw_header =~ /^#{key}: (.*)$/i headers[key] = $1 end end -- William <wmorgan-sup at masanjin.net>
William Morgan
2007-Dec-05 18:36 UTC
[sup-talk] [PATCH] New hook to allow formatting of message headers
Excerpts from William Morgan''s message of Wed Dec 05 10:12:16 -0800 2007:> I''ve applied this to SVN trunk, but (as I am wont to do) I tweaked it a > bit.Tweaked it a little more to use an OrderedHash and to just modify the headers in place. This way the header ordering is not random. Here''s the new hook: $ cat detailed-headers.rb %w(User-Agent X-Mailer X-Spam-Status).map do |key| if message.raw_header =~ /^#{key}: (.*)$/i headers[key] = $1 end end -- William <wmorgan-sup at masanjin.net>
Nicolas Pouillard
2007-Dec-06 17:14 UTC
[sup-talk] [PATCH] New hook to allow formatting of message headers
Excerpts from William Morgan''s message of Wed Dec 05 19:36:44 +0100 2007:> Excerpts from William Morgan''s message of Wed Dec 05 10:12:16 -0800 2007: > > I''ve applied this to SVN trunk, but (as I am wont to do) I tweaked it a > > bit. > > Tweaked it a little more to use an OrderedHash and to just modify the > headers in place. This way the header ordering is not random. > > Here''s the new hook: > > $ cat detailed-headers.rb > %w(User-Agent X-Mailer X-Spam-Status).map do |key|Why use .map instead of .each the result seems not that useful.> if message.raw_header =~ /^#{key}: (.*)$/i > headers[key] = $1 > end > end >-- Nicolas Pouillard aka Ertai
William Morgan
2007-Dec-07 18:10 UTC
[sup-talk] [PATCH] New hook to allow formatting of message headers
Excerpts from nicolas.pouillard''s message of Thu Dec 06 09:12:09 -0800 2007:> Excerpts from William Morgan''s message of Wed Dec 05 19:36:44 +0100 2007: > > %w(User-Agent X-Mailer X-Spam-Status).map do |key| > > Why use .map instead of .each the result seems not that useful.You''re right, #each would have been probably more idiomatic. -- William <wmorgan-sup at masanjin.net>