spamassassin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From quin...@apache.org
Subject svn commit: r125683 - /spamassassin/trunk/lib/Mail/SpamAssassin/EvalTests.pm
Date Wed, 19 Jan 2005 23:47:29 GMT
Author: quinlan
Date: Wed Jan 19 15:47:26 2005
New Revision: 125683

URL: http://svn.apache.org/viewcvs?view=rev&rev=125683
Log:
bug 2954: testing possible improvements for check_for_to_in_subject()

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

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/EvalTests.pm
Url: http://svn.apache.org/viewcvs/spamassassin/trunk/lib/Mail/SpamAssassin/EvalTests.pm?view=diff&rev=125683&p1=spamassassin/trunk/lib/Mail/SpamAssassin/EvalTests.pm&r1=125682&p2=spamassassin/trunk/lib/Mail/SpamAssassin/EvalTests.pm&r2=125683
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/EvalTests.pm	(original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/EvalTests.pm	Wed Jan 19 15:47:26 2005
@@ -2662,7 +2662,31 @@
   elsif ($test eq "user") {
     my $to = $full_to;
     $to =~ s/\@.*//;
-    return $subject =~ /^\s*\Q$to\E,\S/i;	# "user,\S" case insensitive
+    return $subject =~ /^\s*\Q$to\E,\s/i;	# "user,\s" case insensitive
+  }
+  return 0;
+}
+
+# bug 2954
+sub check_for_to_in_subject_bug_2954 {
+  my ($self, $test) = @_;
+
+  my $full_to = $self->get('To:addr');
+  return 0 unless $full_to;
+
+  my $subject = $self->get('Subject');
+
+  if ($test eq "address") {
+      # "user@domain.com"
+      return (($subject =~ /^\s*\Q$full_to\E[\.\,\-]+\s*\S/i) ||
+	      ($subject =~ /\S\s*[\.\,\-]+\Q$full_to\E(?:[\!\?\.]+)$/i));
+  }
+  elsif ($test eq "user") {
+    my $to = $full_to;
+    $to =~ s/\@.*//;
+    # "user,\S" case insensitive
+    return (($subject =~ /^\s*\Q$to\E[\.\,\-]+\s*\S/i) ||
+	    ($subject =~ /\S\s*[\.\,\-]+\Q$to\E(?:[\!\?\.]+)$/i));
   }
   return 0;
 }

Mime
View raw message