[vhffs-dev] [1391] improved from regexp (yes, again ;)

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


Revision: 1391
Author:   gradator
Date:     2009-04-12 15:05:10 +0200 (Sun, 12 Apr 2009)

Log Message:
-----------
improved from regexp (yes, again ;)

Modified Paths:
--------------
    trunk/vhffs-listengine/src/listengine.pl


Modified: trunk/vhffs-listengine/src/listengine.pl
===================================================================
--- trunk/vhffs-listengine/src/listengine.pl	2009-04-12 12:05:27 UTC (rev 1390)
+++ trunk/vhffs-listengine/src/listengine.pl	2009-04-12 13:05:10 UTC (rev 1391)
@@ -188,7 +188,7 @@
     my $header;
     my $email;
     my ( $message_id  ) =  ($mail->get( 'Message-Id' ) =~ /<(.+)>/);
-    my ( $from ) = ( $mail->get('From') =~ /([^\s<"]+@[^>\s"]+)/);
+    my ( $from ) = ( $mail->get('From') =~ /([^\s\@<"]+\@[^">\@\s]+)>?\s*$/ );
     $from = lc $from;
     my $directory = get_moderation_dir( $list );
     my $subject = $mail->get('Subject');
@@ -664,7 +664,7 @@
 
 	exit -1 if( ! defined $list );
     
-	my ( $from ) = ( $mail->get('From') =~ /(([\+\.a-zA-Z_\-0-9^\s]+)@([a\.-zA-Z_\-0-9^\s]+)\.(\w+))/);
+	my ( $from ) = ( $mail->get('From') =~ /([^\s\@<"]+\@[^">\@\s]+)>?\s*$/ );
         $from = lc $from;
 	my $subject = $mail->get('Subject');
 	my $subs = $list->get_members;
@@ -805,7 +805,7 @@
     my $mail = shift;
     my $list = shift;
 
-    my ( $from ) = ( $mail->get('From') =~ /([^\s<"]+@[^>\s"]+)/);
+    my ( $from ) = ( $mail->get('From') =~ /([^\s\@<"]+\@[^">\@\s]+)>?\s*$/ );
     $from = lc $from;
     my $subject = $mail->get('Subject');
     my $action;
@@ -1096,7 +1096,7 @@
 sub get_lang
 {
     my $mail = shift;
-    my ( $from ) = ( $mail->get('From') =~ /([^\s<"]+@[^>\s"]+)/);
+    my ( $from ) = ( $mail->get('From') =~ /([^\s\@<"]+\@[^">\@\s]+)>?\s*$/ );
     $from = lc $from;
 
     my $lang = Vhffs::Services::MailingList::get_language_for_sub( $vhffs , $from );
@@ -1119,7 +1119,7 @@
 	my $list = shift;
 	my $mail = shift;
 
-	my ( $from ) = ( $mail->get('From') =~ /([^\s<"]+@[^>\s"]+)/);
+	my ( $from ) = ( $mail->get('From') =~ /([^\s\@<"]+\@[^">\@\s]+)>?\s*$/ );
 	exit( 0 ) unless defined $from;
 	exit( 0 ) if( $from eq '' );
 


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