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

raeburn lon-capa-cvs@mail.lon-capa.org
Wed, 13 Dec 2006 01:45:16 -0000


raeburn		Tue Dec 12 20:45:16 2006 EDT

  Modified files:              
    /loncom/interface	lonmsg.pm 
  Log:
  bug 4745 sent message now stored for critical messages sent in on-course context.
  
  
Index: loncom/interface/lonmsg.pm
diff -u loncom/interface/lonmsg.pm:1.189 loncom/interface/lonmsg.pm:1.190
--- loncom/interface/lonmsg.pm:1.189	Wed Dec  6 18:44:33 2006
+++ loncom/interface/lonmsg.pm	Tue Dec 12 20:45:15 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines for messaging
 #
-# $Id: lonmsg.pm,v 1.189 2006/12/06 23:44:33 raeburn Exp $
+# $Id: lonmsg.pm,v 1.190 2006/12/13 01:45:15 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -379,24 +379,29 @@
 sub user_crit_msg_raw {
     my ($user,$domain,$subject,$message,$sendback,$toperm,$sentmessage)=@_;
 # Check if allowed missing
-    my $status='';
+    my ($status,$packed_message);
     my $msgid='undefined';
     unless (($message)&&($user)&&($domain)) { $status='empty'; };
     my $text=$message;
     my $homeserver=&Apache::lonnet::homeserver($user,$domain);
     if ($homeserver ne 'no_host') {
-       ($msgid,$message)=&packagemsg($subject,$message);
-       if ($sendback) { $message.='<sendback>true</sendback>'; }
+       ($msgid,$packed_message)=&packagemsg($subject,$message);
+       if ($sendback) { $packed_message.='<sendback>true</sendback>'; }
        $status=&Apache::lonnet::critical(
            'put:'.$domain.':'.$user.':critical:'.
            &escape($msgid).'='.
-           &escape($message),$homeserver);
+           &escape($packed_message),$homeserver);
         if (defined($sentmessage)) {
-            $$sentmessage = $message;
+            $$sentmessage = $packed_message;
         }
+        (undef,my $packed_message_no_citation) =
+            &packagemsg($subject,$message,undef,undef,undef,$user,$domain,
+                        $msgid);
+        $status .= &store_sent_mail($msgid,$packed_message_no_citation);
     } else {
        $status='no_host';
     }
+
 # Notifications
     my %userenv = &Apache::loncommon::getemails($user,$domain);
     if ($userenv{'critnotification'}) {
@@ -518,11 +523,9 @@
                (&Apache::lonnet::allowed('srm',$env{'request.course.id'})
 		|| &Apache::lonnet::allowed('srm',$env{'request.course.id'}.
 					    '/'.$env{'request.course.sec'})))) {
-           (undef, my $packed_message_no_citation)=
-                             &packagemsg($subject,$message,undef     ,$baseurl,
-                                          $attachmenturl,$user,$domain,$currid,
-                                                              undef,$crsmsgid);
-
+           (undef,my $packed_message_no_citation) =
+               &packagemsg($subject,$message,undef,$baseurl,$attachmenturl,
+                           $user,$domain,$currid,undef,$crsmsgid);
            $status .= &store_sent_mail($msgid,$packed_message_no_citation);
        }
     } else {