You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by gb...@apache.org on 2022/04/11 10:28:47 UTC

svn commit: r1899742 - /spamassassin/trunk/lib/Mail/SpamAssassin/Client.pm

Author: gbechis
Date: Mon Apr 11 10:28:47 2022
New Revision: 1899742

URL: http://svn.apache.org/viewvc?rev=1899742&view=rev
Log:
add support for REPORT and REPORT_IFSPAM commands

Modified:
    spamassassin/trunk/lib/Mail/SpamAssassin/Client.pm

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Client.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/Client.pm?rev=1899742&r1=1899741&r2=1899742&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Client.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Client.pm Mon Apr 11 10:28:47 2022
@@ -135,6 +135,8 @@ threshold
 
 message
 
+report
+
 =cut
 
 sub process {
@@ -150,6 +152,41 @@ sub process {
   return $self->_filter($msg, $command);
 }
 
+=head2 spam_report
+
+public instance (\%) spam_report (String $msg)
+
+Description:
+The method implements the report call.
+
+See the process method for the return value.
+
+=cut
+
+sub spam_report {
+  my ($self, $msg) = @_;
+
+  return $self->_filter($msg, 'REPORT');
+}
+
+=head2 spam_report_ifspam
+
+public instance (\%) spam_report_ifspam (String $msg)
+
+Description:
+The method implements the report_ifspam call.
+A report will be returned only if the message is spam.
+
+See the process method for the return value.
+
+=cut
+
+sub spam_report_ifspam {
+  my ($self, $msg) = @_;
+
+  return $self->_filter($msg, 'REPORT_IFSPAM');
+}
+
 =head2 check
 
 public instance (\%) check (String $msg)
@@ -534,6 +571,8 @@ threshold
 
 message (if available)
 
+report (if available)
+
 =cut
 
 sub _filter {
@@ -595,7 +634,11 @@ sub _filter {
     $!==EBADF ? dbg("error reading from spamd (10): $!")
               : die "error reading from spamd (10): $!";
 
-  $data{message} = $return_msg if ($return_msg);
+  if($command =~ /^REPORT/) {
+    $data{report} = $return_msg if ($return_msg);
+  } else {
+    $data{message} = $return_msg if ($return_msg);
+  }
 
   close $remote  or die "error closing socket: $!";