[vhffs-dev] [431] Fixes prefix tag recognition

[ Thread Index | Date Index | More vhffs.org/vhffs-dev Archives ]


Revision: 431
Author:   gradator
Date:     2007-02-02 23:48:23 +0000 (Fri, 02 Feb 2007)

Log Message:
-----------
Fixes prefix tag recognition

Modified Paths:
--------------
    branches/vhffs_4.1/vhffs-listengine/src/listengine.pl
    trunk/vhffs-listengine/src/listengine.pl


Modified: branches/vhffs_4.1/vhffs-listengine/src/listengine.pl
===================================================================
--- branches/vhffs_4.1/vhffs-listengine/src/listengine.pl	2007-02-02 13:35:25 UTC (rev 430)
+++ branches/vhffs_4.1/vhffs-listengine/src/listengine.pl	2007-02-02 23:48:23 UTC (rev 431)
@@ -410,37 +410,37 @@
 #Change some mail headers and send it to each subscriber
 sub sendmail_to_list
 {
-    my $mail = shift;
-    my $list = shift;
-    my $listmail = $list->get_localpart . "\@" . $list->get_domain;
-    my $subs = $list->get_members;
+	my $mail = shift;
+	my $list = shift;
+	my $listmail = $list->get_localpart . "\@" . $list->get_domain;
+	my $subs = $list->get_members;
    
-    my @tos;
+	my @tos;
 
-    #Replace the Reply-To field if selected in the panel  
-    add_list_header( $mail , $list );
-    $mail->replace( 'Reply-To' , $list->get_localpart ."\@" . $list->get_domain ) if( $list->get_replyto == 1 );
+	#Replace the Reply-To field if selected in the panel  
+	add_list_header( $mail , $list );
+	$mail->replace( 'Reply-To' , $list->get_localpart ."\@" . $list->get_domain ) if( $list->get_replyto == 1 );
 
 
-    #Add prefix if not null
-    my $subject=$mail->get('Subject');
-    my $prefix=$list->get_prefix;
-    my $qprefix = quotemeta $prefix;
-    unless ($subject=~ /^.*\[$qprefix\].*$/)
-      {
-      $mail->replace( 'Subject' , "[".$list->get_prefix."]" . " " . $mail->get('Subject') ) if( length( $list->get_prefix ) > 0 );
-      }
+	#Add prefix if not null
+	my $subject = $mail->get('Subject');
+	my $tsubject = $subject;
+	$tsubject =~ s/[\n\r]//g;
+	my $prefix = $list->get_prefix;
+	my $qprefix = quotemeta $prefix;
+	unless ( $tsubject =~ /\[$qprefix\]/)
+	{
+		$mail->replace( 'Subject' , "[".$prefix."]"." ".$subject ) if( length( $prefix ) > 0 );
+	}
 
+	foreach ( keys %{$subs} )
+	{
+		#Send mail to user if he is a confirmed subscriber
+		push( @tos , $_ ) if( $subs->{$_}{perm} != Vhffs::Constants::ML_RIGHT_SUB_WAITING_FOR_REPLY  &&  $subs->{$_}{member} ne $listmail );
+	}
 
-    foreach ( keys %{$subs} )
-    {
-	#Send mail to user if he is a confirmed subscriber
-	push( @tos , $_ ) if( $subs->{$_}{perm} != Vhffs::Constants::ML_RIGHT_SUB_WAITING_FOR_REPLY  &&  $subs->{$_}{member} ne $listmail );
-    }
-
- 
-    sendmail( $mail , \@tos );
-    archive_it( $mail , $list );
+	sendmail( $mail , \@tos );
+	archive_it( $mail , $list );
 }
 
 

Modified: trunk/vhffs-listengine/src/listengine.pl
===================================================================
--- trunk/vhffs-listengine/src/listengine.pl	2007-02-02 13:35:25 UTC (rev 430)
+++ trunk/vhffs-listengine/src/listengine.pl	2007-02-02 23:48:23 UTC (rev 431)
@@ -409,37 +409,37 @@
 #Change some mail headers and send it to each subscriber
 sub sendmail_to_list
 {
-    my $mail = shift;
-    my $list = shift;
-    my $listmail = $list->get_localpart . "\@" . $list->get_domain;
-    my $subs = $list->get_members;
+	my $mail = shift;
+	my $list = shift;
+	my $listmail = $list->get_localpart . "\@" . $list->get_domain;
+	my $subs = $list->get_members;
    
-    my @tos;
+	my @tos;
 
-    #Replace the Reply-To field if selected in the panel  
-    add_list_header( $mail , $list );
-    $mail->replace( 'Reply-To' , $list->get_localpart ."\@" . $list->get_domain ) if( $list->get_replyto == 1 );
+	#Replace the Reply-To field if selected in the panel  
+	add_list_header( $mail , $list );
+	$mail->replace( 'Reply-To' , $list->get_localpart ."\@" . $list->get_domain ) if( $list->get_replyto == 1 );
 
 
-    #Add prefix if not null
-    my $subject=$mail->get('Subject');
-    my $prefix=$list->get_prefix;
-    my $qprefix = quotemeta $prefix;
-    unless ($subject=~ /^.*\[$qprefix\].*$/)
-      {
-      $mail->replace( 'Subject' , "[".$list->get_prefix."]" . " " . $mail->get('Subject') ) if( length( $list->get_prefix ) > 0 );
-      }
+	#Add prefix if not null
+	my $subject = $mail->get('Subject');
+	my $tsubject = $subject;
+	$tsubject =~ s/[\n\r]//g;
+	my $prefix = $list->get_prefix;
+	my $qprefix = quotemeta $prefix;
+	unless ( $tsubject =~ /\[$qprefix\]/)
+	{
+		$mail->replace( 'Subject' , "[".$prefix."]"." ".$subject ) if( length( $prefix ) > 0 );
+	}
 
+	foreach ( keys %{$subs} )
+	{
+		#Send mail to user if he is a confirmed subscriber
+		push( @tos , $_ ) if( $subs->{$_}{perm} != Vhffs::Constants::ML_RIGHT_SUB_WAITING_FOR_REPLY  &&  $subs->{$_}{member} ne $listmail );
+	}
 
-    foreach ( keys %{$subs} )
-    {
-	#Send mail to user if he is a confirmed subscriber
-	push( @tos , $_ ) if( $subs->{$_}{perm} != Vhffs::Constants::ML_RIGHT_SUB_WAITING_FOR_REPLY  &&  $subs->{$_}{member} ne $listmail );
-    }
-
- 
-    sendmail( $mail , \@tos );
-    archive_it( $mail , $list );
+	sendmail( $mail , \@tos );
+	archive_it( $mail , $list );
 }
 
 


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/