Summary | spam-filtering for maildrop |
Queue | Ingo |
Queue Version | HEAD |
Type | Enhancement |
State | Resolved |
Priority | 2. Medium |
Owners | chuck (at) horde (dot) org |
Requester | steinkel (at) ctinetworks (dot) com |
Created | 10/30/2007 (6463 days ago) |
Due | |
Updated | 11/20/2007 (6442 days ago) |
Assigned | 10/31/2007 (6462 days ago) |
Resolved | 11/20/2007 (6442 days ago) |
Milestone | |
Patch | No |
State ⇒ Resolved
New Attachment: maildrop.diff
your code should work fine even if conditions are joined by OR.
However the 'not equal' test should use != as operator, instead of
! /Header:.../ && $MATCH1 == condition,
because that would indeed not work. Furthermore, 'not equal' must then
be excluded from the negation above (line 557 in HEAD). Patch attached.
PS: The patch also removes some duplicated code by defining the
numerical relation operators in an instance variable. Remove this if
you don't find it appropriate.
example. Can you please check:
http://cvs.horde.org/diff.php/ingo/lib/Script/maildrop.php?r1=1.17&r2=1.18&ty=u
Thanks!
joined by OR. I'll take a shot at it these days, some of the
refactoring I've planned to do sometime... Hang on ;) If it's urgent,
I'm sure we can find a fix without the restructuring.
State ⇒ Feedback
example. Can you please check:
http://cvs.horde.org/diff.php/ingo/lib/Script/maildrop.php?r1=1.17&r2=1.18&ty=u
Thanks!
referenced this bug...
I was referring to the numerical comparisons added in rev 1.17, not to
the spam action. My bad. The point remains still valid of course...
The way maildrop condition generation works atm, each condition starts with /^
(see this line: $string .= '/^' . $condition['field'] . ':\\s*';),
which starts a regular expression.
Like I said in
bug #5816, implementing numerical comparisons wouldrequire more changes to the script.
In a maildrop script, a numerical comparison (e.g. >=) for a certain
header field (e.g. HeaderName) and a certain value (e.g. 5, from
(int)$condition['value']) would best be implemented as
(/^HeaderName:\s*(\d+(\.\d+)?)/h && $MATCH1 >= 5)
This would work fine with the current script generation algorithm,
except an opening parenthesis would have to be added at the beginning
of a condition for numerical comparisons, and the second part of the
condition would have to be added AFTER the regular expression is
closed and also AFTER the flags are added (which is why I didn't
implement this in the above mentioned bug/patch, but tried to
restructure the whole thing to make it more readable).
However, If I got that right, the current HEAD of the maildrop.php
however will produce something like
/^HeaderName:\s* >= 5/h
which is of course complete bogus.
Please revert the changes until a proper patch is provided.
State ⇒ Resolved
Assigned to Chuck Hagenbuch
State ⇒ Assigned
comparisons, so numeric was not of such importance to us. I had not
gotten to seeing whether maildrop was capable of them, but figured it
would be useful to post what I had.
numeric comparisons are requested, then?
comparisons, so numeric was not of such importance to us. I had not
gotten to seeing whether maildrop was capable of them, but figured it
would be useful to post what I had.
our customers and should not have been included.
State ⇒ Feedback
numeric comparisons are requested, then?
Also, what's the +2 for? (after $spam->getSpamLevel())
Priority ⇒ 2. Medium
Type ⇒ Enhancement
Summary ⇒ spam-filtering for maildrop
Queue ⇒ Ingo
New Attachment: ingo.maildrop.php.patch
State ⇒ New
ingo/lib/Script/maildrop.php to allow maildrop scripts to use the
INGO_STORAGE_ACTION_SPAM action. As of now, it does 'string' and not
'numeric' comparisons.