SA Bugzilla – Bug 3815
[review] access relay country in header
Last modified: 2006-04-05 16:48:08 UTC
Attached is a patch to Plugin/RelayCountry.pm that allows you to access the plugin metadata so you can add a x-spam-relay header showing which countries the message was sent through using: add_header all Relay _RELAYCOUNTRY_ in your conf.
Created attachment 2367 [details] patch to make the header available in the parsed message
Triage: Too late IMO to try for 3.1.0, but it looks like a simple enough enhancement to place into 3.1.1.
Created attachment 3298 [details] redone patch Does this work? it's a little cleaner, and less likely to be brittle IMO.
justin, do you want this patch to be considered for 3.1.1?
yep, why not
+1
Sending lib/Mail/SpamAssassin/Plugin/RelayCountry.pm Transmitting file data . Committed revision 381560.
Hi, This isn't working for me with 3.1.1. I think the problem is that you are adding the relay info to the message object: $msg->{tag_data}{RELAYCOUNTRY} = $countries; and in sub _get_tag in PerMsgStatus.pm which handles the header parsing: elsif ($self->{tag_data}->{$tag}) { my $data = $self->{tag_data}->{$tag}; if (ref $data eq 'CODE') { return $data->(@_); } else { return $data; } } $self->{tag_data} is from the PerMsgStatus object. I don't see anywhere where the tag_data from the Message object is copied into the tag_data of PerMsgStatus object so you end up with a blank header value. I also couldn't see anything obvious on how to get the PerMsgStatus object from within extract_data in the plugin.
The canceled patch from 2004.09.23 works, by the way.
+1, for not working in 3.1.1
Created attachment 3444 [details] fix oops. guess we should have got someone to test it before putting it in 3.1.1 ;) It does indeed appear that the extract_metadata() plugin hook doesn't have the permsgstatus object available. Try this one -- it uses the parsed_metadata() hook again. it's a lot closer to the first patch (although using the public apis where possible, as a plugin is supposed to). this time let's wait for someone to give us a +1 before we put it in 3.1.2 ;)
+1, latest patch works for me.
oops. +1 on 3444
+1 tested, works. Don't forget to apply to trunk too.
applied: b310: r391839 trunk: r391838