[LON-CAPA-cvs] cvs: loncom /interface lonpreferences.pm

raeburn raeburn@source.lon-capa.org
Thu, 07 Jan 2010 21:55:17 -0000


raeburn		Thu Jan  7 21:55:17 2010 EDT

  Modified files:              
    /loncom/interface	lonpreferences.pm 
  Log:
  - Allow setting of forwarding to usernames which are e-mail addresses.
  
  
Index: loncom/interface/lonpreferences.pm
diff -u loncom/interface/lonpreferences.pm:1.181 loncom/interface/lonpreferences.pm:1.182
--- loncom/interface/lonpreferences.pm:1.181	Tue Dec 15 14:52:00 2009
+++ loncom/interface/lonpreferences.pm	Thu Jan  7 21:55:17 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Preferences
 #
-# $Id: lonpreferences.pm,v 1.181 2009/12/15 14:52:00 wenzelju Exp $
+# $Id: lonpreferences.pm,v 1.182 2010/01/07 21:55:17 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -998,16 +998,21 @@
     my $domain     = $env{'user.domain'};
     my $newscreen  = '';
     my $message='';
-    foreach (split(/\,/,$env{'form.msgforward'})) {
-	my ($msuser,$msdomain)=split(/[\@\:]/,$_);
+    foreach my $recip (split(/\,/,$env{'form.msgforward'})) {
+        my ($msuser,$msdomain);
+        if ($recip =~ /:/) {
+            ($msuser,$msdomain)=split(':',$recip);
+        } else {
+            ($msuser,$msdomain)=split(/\@/,$recip);
+        }
         $msuser = &LONCAPA::clean_username($msuser);
         $msdomain = &LONCAPA::clean_domain($msdomain);
         if (($msuser) && ($msdomain)) {
 	    if (&Apache::lonnet::homeserver($msuser,$msdomain) ne 'no_host') {
-               $newscreen.=$msuser.':'.$msdomain.',';
-	   } else {
-               $message.= &mt('No such user: ').'<tt>'.$msuser.':'.$msdomain.'</tt><br />';
-           }
+                $newscreen.=$msuser.':'.$msdomain.',';
+	    } else {
+                $message.= &mt('No such user: ').'<tt>'.$msuser.':'.$msdomain.'</tt><br />';
+            }
         }
     }
     $newscreen=~s/\,$//;