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

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Tue, 04 Nov 2008 04:18:22 -0000


raeburn		Tue Nov  4 04:18:22 2008 EDT

  Modified files:              
    /loncom/interface	lonmsg.pm 
  Log:
  - New <group></group> entry in packaged message to store group for group broadcasts.
  - Email to permanentemail, only send if notification has not also been sent to same address.
  - process_sent_mail() takes extra argument - recipid, so it can be passed to &packagemsg() for access to recipients by type (To, Cc, Bcc, Broadcast etc.).
  
  
Index: loncom/interface/lonmsg.pm
diff -u loncom/interface/lonmsg.pm:1.213 loncom/interface/lonmsg.pm:1.214
--- loncom/interface/lonmsg.pm:1.213	Sat Sep 13 02:37:26 2008
+++ loncom/interface/lonmsg.pm	Tue Nov  4 04:18:22 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines for messaging
 #
-# $Id: lonmsg.pm,v 1.213 2008/09/13 02:37:26 raeburn Exp $
+# $Id: lonmsg.pm,v 1.214 2008/11/04 04:18:22 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -120,6 +120,9 @@
 	   '<role>'.$env{'request.role'}.'</role>'.
 	   '<resource>'.$env{'request.filename'}.'</resource>'.
            '<msgid>'.$msgid.'</msgid>';
+    if (defined($env{'form.group'})) {
+        $result .= '<group>'.$env{'form.group'}.'</group>';
+    }
     if (ref($recuser) eq 'ARRAY') {
         for (my $i=0; $i<@{$recuser}; $i++) {
             if ($type eq 'dcmail') {
@@ -688,8 +691,10 @@
 			     $text,$msgid);
        }
        if ($toperm && $userenv{'permanentemail'}) {
-	   &sendnotification($userenv{'permanentemail'},$user,$domain,$subject,0,
-			     $text,$msgid);
+           if ((!$userenv{'notification'}) || ($userenv{'notification'} ne $userenv{'permanentemail'})) {
+	       &sendnotification($userenv{'permanentemail'},$user,$domain,$subject,0,
+	  		         $text,$msgid);
+           }
        }
        &Apache::lonnet::log($env{'user.domain'},$env{'user.name'},
 			    $env{'user.home'},
@@ -748,7 +753,7 @@
 }
 
 sub process_sent_mail {
-    my ($msgsubj,$subj_prefix,$numsent,$stamp,$msgname,$msgdom,$msgcount,$context,$pid,$savemsg,$recusers,$recudoms,$baseurl,$attachmenturl,$symb,$error,$senderuname,$senderdom) = @_;
+    my ($msgsubj,$subj_prefix,$numsent,$stamp,$msgname,$msgdom,$msgcount,$context,$pid,$savemsg,$recusers,$recudoms,$baseurl,$attachmenturl,$symb,$error,$senderuname,$senderdom,$recipid) = @_;
     my $sentsubj;
     if ($numsent > 1) {
         $sentsubj = $subj_prefix.' ('.$numsent.' sent) '.$msgsubj;
@@ -763,7 +768,7 @@
         &buildmsgid($stamp,$sentsubj,$msgname,$msgdom,$msgcount,$context,$pid);
     (undef,my $sentmessage) =
         &packagemsg($msgsubj,$savemsg,undef,$baseurl,$attachmenturl,$recusers,
-                    $recudoms,$sentmsgid,undef,undef,$symb,$error);
+                    $recudoms,$sentmsgid,undef,undef,$symb,$error,$recipid);
     my $status = &store_sent_mail($sentmsgid,$sentmessage,$senderuname,
                                   $senderdom);
     return $status;