You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@spamassassin.apache.org by bu...@bugzilla.spamassassin.org on 2006/07/18 10:24:54 UTC
[Bug 4996] New: Additional SCORE multiplication factor - wishlist
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4996
Summary: Additional SCORE multiplication factor - wishlist
Product: Spamassassin
Version: 3.0.3
Platform: PC
OS/Version: Linux
Status: NEW
Severity: enhancement
Priority: P5
Component: Score Generation
AssignedTo: dev@spamassassin.apache.org
ReportedBy: reiffert@student.physik.uni-mainz.de
Modifying PerMsgStatus as follows allows me to
use
add_header all mytag _SCOREMUL_
within local.cf
--- PerMsgStatus.pm~ 2006-07-17 23:49:09.000000000 +0200
+++ PerMsgStatus.pm 2006-07-17 23:49:09.000000000 +0200
@@ -1111,7 +1111,7 @@
%tags = ( YESNO => sub { $self->_get_tag_value_for_yesno() },
YESNOCAPS => sub { uc $self->_get_tag_value_for_yesno() },
-
+ SCOREMUL => sub { $self->_get_tag_value_for_score(shift) * 10 },
SCORE => sub { $self->_get_tag_value_for_score(shift) },
HITS => sub { $self->_get_tag_value_for_score(shift) },
which helps me to do *numerical and integer* tests on the further
mail-processing without converting the SCORE in prior to
calculation.
This was the easiest way for me to handle. I asume writing a plugin could
be an alternative / the right way.
Kind regards
Thomas Reifferscheid
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
[Bug 4996] Additional SCORE multiplication factor - wishlist
Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4996
------- Additional Comments From felicity@apache.org 2006-07-18 21:18 -------
Just to follow up, even though it doesn't belong here darn it ... ;)
Thomas, Michael, and myself chatted via IRC. In the end, this code would
probably work -- except that Thomas is running 3.0 which doesn't allow set_tag()
to do coderefs (because get_tag() doesn't handle it). 3.1 and beyond DTRT in
get_tag().
(In reply to comment #3)
> untested, but something like:
>
>
> package ScoreMulPlugin;
> use Mail::SpamAssassin::Plugin;
> our @ISA = qw(Mail::SpamAssassin::Plugin);
>
> sub new {
> my $class = shift;
> my $mailsaobject = shift;
> $class = ref($class) || $class;
> my $self = $class->SUPER::new($mailsaobject);
> bless ($self, $class);
> return $self;
> }
>
> sub parsed_metadata {
> my ($self, $opts) = @_;
> my $permsg = $opts->{permsgstatus};
> $permsg->set_tag('SCOREMUL', sub { $permsg->get_score() * 10 });
> }
>
>
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
[Bug 4996] Additional SCORE multiplication factor - wishlist
Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4996
felicity@apache.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |WONTFIX
------- Additional Comments From felicity@apache.org 2006-07-18 14:54 -------
> This was the easiest way for me to handle. I asume writing a plugin
> could be an alternative / the right way.
Yes, generally speaking a plugin is best for things like this since otherwise
you'll have to maintain and patch new versions as you install SA.
However, I don't think this is of general interest so I'm going to close the
ticket as wontfix.
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
[Bug 4996] Additional SCORE multiplication factor - wishlist
Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4996
------- Additional Comments From felicity@apache.org 2006-07-18 18:56 -------
(In reply to comment #2)
> Closing the issue sounds a bit fast for me.
>
> If you don't mind, please tell me how a plugin would look like
> that implements just that very special thing I did by changing
> a single line to PerMsgStatus.pm
>
> Well integer numbers are of general interest (at least to my eyes).
> As well as how to write such a plugin when you've never done so.
>
> Can you help me with that?
Hi.
Sorry about that, it's just that Bugzilla isn't really the place to discuss
things like how to write a plugin, etc. I see that Justin posted some possible
code as an example, so that may be useful. In general though, things like this
ought to be discussed on the users@spamassassin.apache.org list.
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
[Bug 4996] Additional SCORE multiplication factor - wishlist
Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4996
------- Additional Comments From reiffert@student.physik.uni-mainz.de 2006-07-19 06:45 -------
(In reply to comment #7)
> As a trivial change to get around the 3.1.0 problem, would something like this
> work:
>
> > sub parsed_metadata {
> > my ($self, $opts) = @_;
> > my $permsg = $opts->{permsgstatus};
> my $score = $permsg->get_score() * 10;
> $permsg->set_tag('SCOREMUL', sub { $score });
> > }
Thanks for answereing, but that does not change anything.
The header still gets "CODE(###)"
Stating from the IRC conversation:
23:16 < felicity> reiffert, the problem is that in 3.0, set_tag() may only ever
set a scalar value. you want to pass in a coderef and have it run, which 3.0
won't do.
23:16 < felicity> reiffert, 3.1 and 3.2 have been modified to do the right thing
and check the scalar to see if it's a code ref, and if it is, the reference gets
executed.
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
[Bug 4996] Additional SCORE multiplication factor - wishlist
Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4996
------- Additional Comments From lwilton@earthlink.net 2006-07-19 05:05 -------
As a trivial change to get around the 3.1.0 problem, would something like this
work:
> sub parsed_metadata {
> my ($self, $opts) = @_;
> my $permsg = $opts->{permsgstatus};
my $score = $permsg->get_score() * 10;
$permsg->set_tag('SCOREMUL', sub { $score });
> }
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
[Bug 4996] Additional SCORE multiplication factor - wishlist
Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4996
------- Additional Comments From felicity@apache.org 2006-07-19 20:16 -------
(In reply to comment #9)
> Duh. I didn't delete enough characters from that last line. Try this:
>
> > $permsg->set_tag('SCOREMUL', $score );
>
> Hum. I'm wondering why Justin put a sub in there originally rather than just
> the simple equation. I bet I'm missing something here.
First, there's absolutely no way to do this in 3.0, so please stop discussing
possible ways to do it (not to mention this is still the wrong place). ;)
Second, the reason it has to be a sub is because you want the tag replaced with
the value at the time of the replacement. If you don't use sub, the tag will be
set to the variable value at time of set_tag(), which is generally before the
scan executes.
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
[Bug 4996] Additional SCORE multiplication factor - wishlist
Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4996
------- Additional Comments From reiffert@student.physik.uni-mainz.de 2006-07-18 20:25 -------
(In reply to comment #4)
> Sorry about that, it's just that Bugzilla isn't really the place to discuss
> things like how to write a plugin, etc. I see that Justin posted some possible
> code as an example, so that may be useful. In general though, things like this
> ought to be discussed on the users@spamassassin.apache.org list.
Ah well, I was looking for writing my own plugin but only found
http://wiki.apache.org/spamassassin/PluginWritingTips?highlight=%28PerMsgStatus%29
so I patched just one line in PerMsgStatus.pm and finally came to the conclusion
that it might be worth a change in Spamassassin.
Btw, the example-plugin-code that was posted here returns
"CODE(0xa259bd8)" in the Mailheader.
I'm a bit clueless, Data::Dumper'ing $permsg to a file didn't help
me find what can be used instead sub { $permsg->get_score(); } here.
Kind regards
Thomas Reifferscheid
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
[Bug 4996] Additional SCORE multiplication factor - wishlist
Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4996
------- Additional Comments From lwilton@earthlink.net 2006-07-19 20:08 -------
Duh. I didn't delete enough characters from that last line. Try this:
> $permsg->set_tag('SCOREMUL', $score );
Hum. I'm wondering why Justin put a sub in there originally rather than just
the simple equation. I bet I'm missing something here.
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
[Bug 4996] Additional SCORE multiplication factor - wishlist
Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4996
------- Additional Comments From reiffert@student.physik.uni-mainz.de 2006-07-18 18:31 -------
Closing the issue sounds a bit fast for me.
If you don't mind, please tell me how a plugin would look like
that implements just that very special thing I did by changing
a single line to PerMsgStatus.pm
Well integer numbers are of general interest (at least to my eyes).
As well as how to write such a plugin when you've never done so.
Can you help me with that?
Kind regards
Thomas Reifferscheid
> Yes, generally speaking a plugin is best for things like this since otherwise
> you'll have to maintain and patch new versions as you install SA.
>
> However, I don't think this is of general interest so I'm going to close the
> ticket as wontfix.
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
[Bug 4996] Additional SCORE multiplication factor - wishlist
Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4996
------- Additional Comments From jm@jmason.org 2006-07-18 18:45 -------
untested, but something like:
package ScoreMulPlugin;
use Mail::SpamAssassin::Plugin;
our @ISA = qw(Mail::SpamAssassin::Plugin);
sub new {
my $class = shift;
my $mailsaobject = shift;
$class = ref($class) || $class;
my $self = $class->SUPER::new($mailsaobject);
bless ($self, $class);
return $self;
}
sub parsed_metadata {
my ($self, $opts) = @_;
my $permsg = $opts->{permsgstatus};
$permsg->set_tag('SCOREMUL', sub { $permsg->get_score() * 10 });
}
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.