/[Apache-SVN]/spamassassin/trunk/lib/Mail/SpamAssassin/Conf.pm
ViewVC logotype

Diff of /spamassassin/trunk/lib/Mail/SpamAssassin/Conf.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

--- spamassassin/trunk/lib/Mail/SpamAssassin/Conf.pm	2005/05/12 02:53:37	169747
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Conf.pm	2005/05/12 03:04:33	169748
@@ -1579,7 +1579,7 @@ existing system rule from a C<user_prefs
     }
   });
 
-=item redirector_pattern	/pattern/
+=item redirector_pattern	/pattern/modifiers
 
 A regex pattern that matches both the redirector site portion, and
 the target site portion of a URI.
@@ -1589,7 +1589,7 @@ Note: The target URI portion must be sur
 
 Example: http://chkpt.zdnet.com/chkpt/whatever/spammer.domain/yo/dude
 
-  redirector_pattern	/^https?:\/\/(?:opt\.)?chkpt\.zdnet\.com\/chkpt\/\w+\/(.*)$/
+  redirector_pattern	/^https?:\/\/(?:opt\.)?chkpt\.zdnet\.com\/chkpt\/\w+\/(.*)$/i
 
 =cut
 
@@ -1599,14 +1599,14 @@ Example: http://chkpt.zdnet.com/chkpt/wh
     code => sub {
       my ($self, $key, $value, $line) = @_;
 
-      if ( $self->{parser}->is_regexp_valid("redirector_pattern", $value)) {
-	# strip off delimiters and modifiers  TODO: include modifiers in qr
-	$value =~ s/^m?(.)(.*)(?:\1|>|}|\)|\]).*?$/$2/;
+      if ($self->{parser}->is_regexp_valid("redirector_pattern", $value)) {
+	# convert to qr// while including modifiers
+	$value =~ /^m?(\W)(.*)(?:\1|>|}|\)|\])(.*?)$/;
+	my $pattern = $2;
+	$pattern = "(?".$3.")".$pattern if $3;
+	$pattern = qr/$pattern/;
 
-	# since the regexp will never change we might as well qr it
-	$value = qr/$value/i;
-
-	push @{$self->{main}->{conf}->{redirector_patterns}}, $value;
+	push @{$self->{main}->{conf}->{redirector_patterns}}, $pattern;
 	dbg("config: adding redirector regex: " . $value);
       }
     }

 

infrastructure at apache.org
ViewVC Help
Powered by ViewVC 1.1.26