Robin Bowes wrote:
I'm following up John's suggestion that I need to tell spamassassin to return details of the tests after "Spam: True <score>". However, I can't see where this is configured other than in the spamc client, which the plugin doesn't appear to use (it talks directly to spamd, I think).

What version of SpamAssassin are you running? The spamc/PROTOCOL documentation specifically discusses the SYMBOL command (which performs a CHECK plus returns a comma delimited list of rules hit). I don't see any notes on the SA website that this command is no longer supported. Turn your loglevel up to LOGDEBUG and you'll see every line returned from dspamd before it is processed.

Ah, maybe I know what is going on: the regex on line 181 may be too simplistic (if any of your tests contains 'S').

<later>

Actually, that code is wrong no matter how you cut is because when you read the next line (which would contain the list of rules matched) and drop out of the loop, you no longer have the list to access (since you've already read that line). Try this instead:

--- plugins/spamassassin        (revision 705)
+++ plugins/spamassassin        (local)
@@ -175,16 +175,18 @@
   }

   my ($flag, $hits, $required);
+  my $tests;
   while (<SPAMD>) {
-    $self->log(LOGDEBUG, "check_spam: spamd: $_");
+    $tests = $_;
+    $self->log(LOGDEBUG, "check_spam: spamd: $tests");
     #warn "GOT FROM SPAMD1: $_";
-    last unless m/\S/;
-    if (m{Spam: (True|False) ; (-?\d+\.\d) / (-?\d+\.\d)}) {
+    last unless $tests =~ m/^SPAM/i;
+    if ($tests =~ m{Spam: (True|False) ; (-?\d+\.\d) / (-?\d+\.\d)}) {
        ($flag, $hits, $required) = ($1, $2, $3);
     }

   }
-  my $tests = <SPAMD>;
+
   $tests =~ s/\015//;  # hack for outlook
   $flag = $flag eq 'True' ? 'Yes' : 'No';
   $self->log(LOGDEBUG, "check_spam: finished reading from spamd");


HTH

John

Reply via email to