[LON-CAPA-cvs] cvs: loncom / lond /interface lonmsg.pm lonnotify.pm

raeburn lon-capa-cvs@mail.lon-capa.org
Sat, 10 Dec 2005 00:46:34 -0000


raeburn		Fri Dec  9 19:46:34 2005 EDT

  Modified files:              
    /loncom	lond 
    /loncom/interface	lonmsg.pm lonnotify.pm 
  Log:
  Use lonmsg::unpackmsgid() to split msgid for sentmail.  remove some unnecessary unescaping from lond.
  
  
Index: loncom/lond
diff -u loncom/lond:1.303 loncom/lond:1.304
--- loncom/lond:1.303	Fri Dec  9 16:17:16 2005
+++ loncom/lond	Fri Dec  9 19:46:23 2005
@@ -2,7 +2,7 @@
 # The LearningOnline Network
 # lond "LON Daemon" Server (port "LOND" 5663)
 #
-# $Id: lond,v 1.303 2005/12/09 21:17:16 albertel Exp $
+# $Id: lond,v 1.304 2005/12/10 00:46:23 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -59,7 +59,7 @@
 my $status='';
 my $lastlog='';
 
-my $VERSION='$Revision: 1.303 $'; #' stupid emacs
+my $VERSION='$Revision: 1.304 $'; #' stupid emacs
 my $remoteVERSION;
 my $currenthostid="default";
 my $currentdomainid;
@@ -3596,10 +3596,7 @@
             my $match = 1;
             my ($timestamp,$subj,$uname,$udom) = 
 		split(/:/,&unescape(&unescape($key)),5); # yes, twice really
-            $timestamp = &unescape($timestamp);
             $subj = &unescape($subj);
-            $uname = &unescape($uname);
-            $udom = &unescape($udom);
             unless ($startfilter eq '.' || !defined($startfilter)) {
                 if ($timestamp < $startfilter) {
                     $match = 0;
Index: loncom/interface/lonmsg.pm
diff -u loncom/interface/lonmsg.pm:1.163 loncom/interface/lonmsg.pm:1.164
--- loncom/interface/lonmsg.pm:1.163	Fri Dec  9 16:18:13 2005
+++ loncom/interface/lonmsg.pm	Fri Dec  9 19:46:34 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines for messaging
 #
-# $Id: lonmsg.pm,v 1.163 2005/12/09 21:18:13 albertel Exp $
+# $Id: lonmsg.pm,v 1.164 2005/12/10 00:46:34 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -266,14 +266,17 @@
 }
 
 sub unpackmsgid {
-    my ($msgid,$folder)=@_;
+    my ($msgid,$folder,$skipstatus)=@_;
     $msgid=&Apache::lonnet::unescape($msgid);
-    my $suffix=&foldersuffix($folder);
     my ($sendtime,$shortsubj,$fromname,$fromdomain,$count,$fromcid)=split(/\:/,
                           &Apache::lonnet::unescape($msgid));
-    my %status=&Apache::lonnet::get('email_status'.$suffix,[$msgid]);
-    if ($status{$msgid}=~/^error\:/) { $status{$msgid}=''; }
-    unless ($status{$msgid}) { $status{$msgid}='new'; }
+    my %status=();
+    unless ($skipstatus) {
+        my $suffix=&foldersuffix($folder);
+        &Apache::lonnet::get('email_status'.$suffix,[$msgid]);
+        if ($status{$msgid}=~/^error\:/) { $status{$msgid}=''; }
+        unless ($status{$msgid}) { $status{$msgid}='new'; }
+    }
     return ($sendtime,$shortsubj,$fromname,$fromdomain,$status{$msgid},$fromcid);
 }
 
Index: loncom/interface/lonnotify.pm
diff -u loncom/interface/lonnotify.pm:1.10 loncom/interface/lonnotify.pm:1.11
--- loncom/interface/lonnotify.pm:1.10	Fri Dec  9 15:54:26 2005
+++ loncom/interface/lonnotify.pm	Fri Dec  9 19:46:34 2005
@@ -306,7 +306,9 @@
                     $rowColor = $rowColor2;
                 }
                 my $recipients = '';
-                my ($date,$subj,$sname,$sdom,$cdom) = split(/:/,$msgid,5);
+                my ($date,$subj,$sname,$sdom) =
+                                  &Apache::lonmsg::unpackmsgid($msgid,undef,1);
+                $subj = &Apache::lonnet::escape($subj);
                 $date = &Apache::lonlocal::locallocaltime($date);
                 foreach my $user (sort(keys(%{$dcmail{$msgid}{recipient}}))) {
                     $recipients .= $dcmail{$msgid}{recipient}{$user}.', ';
@@ -317,7 +319,9 @@
             }
         } else {
             foreach my $msgid (sort(keys(%dcmail))) {
-                my ($date,$subj,$sname,$sdom,$cdom) = split(/:/,$msgid,5);
+                my ($date,$subj,$sname,$sdom) =
+                                   &Apache::lonmsg::unpackmsgid($msgid,undef,1);
+                $subj = &Apache::lonnet::escape($subj);
                 if ($env{'form.sortby'} eq 'subject') {
                     push @{$Sortby{$dcmail{$msgid}{subject}}},$msgid;
                 } elsif ($env{'form.sortby'} eq 'message') {
@@ -351,8 +355,9 @@
                         }
                         $recipients =~ s/,\s$//;
                     }
-
-                    my ($date,$subj,$sname,$sdom,$cdom) = split(/:/,$msgid,5);
+                    my ($date,$subj,$sname,$sdom) =
+                                   &Apache::lonmsg::unpackmsgid($msgid,undef,1);
+                    $subj = &Apache::lonnet::escape($subj);
                     $date = &Apache::lonlocal::locallocaltime($date);
                     $output .=  '<tr bgcolor="'.$rowColor.'"><td><small>'.$date.'</small></td><td><small>'.&cr_to_br($dcmail{$msgid}{subject}).'</small></td><td><small>'.$sname.':'.$sdom.'</small></td><td><small>'.&cr_to_br($dcmail{$msgid}{message}).'</small></td><td><small>'.$recipients.'</small></td></tr>'."\n";
                     $rowNum ++;