Hi Ian,
Ian P. Christian wrote:
2009/2/19 Ian P. Christian <poo...@pookey.co.uk>:
The first if appears to match, as if I move the fileinto up there it
works - however it doesn't work as it shown here. Can anyone suggest
why? Can I achieve what I'm trying to do with sieve? How can I go
about debugging scripts?
You can use the sieve-test command line tool for that. It sure beats
sending test mails through deliver all the time. The debugging
experience needs improvement though, as trace debug output is a bit
cryptic (relates to binary dump) and being able to print debug messages
and variables to the console would be a nice thing to have.
I've made some progress, but now I'm wondering if it's actually possible....
# X-pstn-levels: (S: 0.00799/98.42547 CV:99.9000 FC:95.5390 LC:95.5390
R:95.9108 P:95.9108 M:97.0282 C:98.6951 )
# X-pstn-settings: 3 (1.0000:1.0000) s cv gt3 gt2 gt1 r p m c
if header :matches "X-pstn-levels" "(S: */*"
{
set "score" "${1}";
if header :matches "X-pstn-settings" "? (*:*) *"
{
set "threshold" "${3}";
if "${score}" :under "${threshold}"
{
}
}
}
There doesn't appear to be a way of comparing the value of 2 floating
point numeric variables (or integers for that matter).
Floating point, hmm ... unfortunately no.
If the values were integers you could have done the following:
--
require "relational";
require "variables";
require "comparator-i;ascii-numeric";
require "fileinto";
if header :matches "X-pstn-levels" "(S: */*"
{
set "score" "${1}";
if header :matches "X-pstn-settings" "? (*:*) *" {
set "threshold" "${3}";
if not string :value "lt" "${score}" "${threshold}" {
/* Do whatever */
fileinto "Not spam";
}
}
}
--
You could do some nasty string matching to explicitly match the decimal
separator and match the integer and fractional part separately.
Now I am wondering. What software produces such headers? :)
Regards,
Stephan.