* [sup-talk] [PATCH] New hook to allow formatting of message headers
@ 2007-11-21 4:26 Colin Bell
2007-12-05 18:12 ` William Morgan
0 siblings, 1 reply; 6+ messages in thread
From: Colin Bell @ 2007-11-21 4:26 UTC (permalink / raw)
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* [sup-talk] [PATCH] New hook to allow formatting of message headers
2007-11-21 4:26 [sup-talk] [PATCH] New hook to allow formatting of message headers Colin Bell
@ 2007-12-05 18:12 ` William Morgan
2007-12-05 18:36 ` William Morgan
0 siblings, 1 reply; 6+ messages in thread
From: William Morgan @ 2007-12-05 18:12 UTC (permalink / raw)
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>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [sup-talk] [PATCH] New hook to allow formatting of message headers
2007-12-05 18:12 ` William Morgan
@ 2007-12-05 18:36 ` William Morgan
2007-12-06 17:12 ` Nicolas Pouillard
0 siblings, 1 reply; 6+ messages in thread
From: William Morgan @ 2007-12-05 18:36 UTC (permalink / raw)
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>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [sup-talk] [PATCH] New hook to allow formatting of message headers
2007-12-05 18:36 ` William Morgan
@ 2007-12-06 17:12 ` Nicolas Pouillard
2007-12-06 17:14 ` Nicolas Pouillard
2007-12-07 18:10 ` William Morgan
0 siblings, 2 replies; 6+ messages in thread
From: Nicolas Pouillard @ 2007-12-06 17:12 UTC (permalink / raw)
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* [sup-talk] [PATCH] New hook to allow formatting of message headers
2007-12-06 17:12 ` Nicolas Pouillard
@ 2007-12-06 17:14 ` Nicolas Pouillard
2007-12-07 18:10 ` William Morgan
1 sibling, 0 replies; 6+ messages in thread
From: Nicolas Pouillard @ 2007-12-06 17:14 UTC (permalink / raw)
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* [sup-talk] [PATCH] New hook to allow formatting of message headers
2007-12-06 17:12 ` Nicolas Pouillard
2007-12-06 17:14 ` Nicolas Pouillard
@ 2007-12-07 18:10 ` William Morgan
1 sibling, 0 replies; 6+ messages in thread
From: William Morgan @ 2007-12-07 18:10 UTC (permalink / raw)
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>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2007-12-07 18:10 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-21 4:26 [sup-talk] [PATCH] New hook to allow formatting of message headers Colin Bell
2007-12-05 18:12 ` William Morgan
2007-12-05 18:36 ` William Morgan
2007-12-06 17:12 ` Nicolas Pouillard
2007-12-06 17:14 ` Nicolas Pouillard
2007-12-07 18:10 ` William Morgan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox