Diff for /loncom/interface/lonmsg.pm between versions 1.198 and 1.199

version 1.198, 2007/03/02 23:17:59 version 1.199, 2007/04/22 02:25:36
Line 28 Line 28
   
 package Apache::lonmsg;  package Apache::lonmsg;
   
   =pod
   
   =head1 NAME
   
   Apache::lonmsg: supports internal messaging
   
   =head1 SYNOPSIS
   
   lonmsg provides routines for sending messages.
   
   Right now, this document will cover just how to send a message, since
   it is likely you will not need to programmatically read messages,
   since lonmsg already implements that functionality.
   
   The routines used to package messages and unpackage messages are not
   only used by lonmsg when creating/extracting messages for LON-CAPA's
   internal messaging system, but also by lonnotify.pm which is available
   for use by Domain Coordinators to broadcast standard e-mail to specified
   users in their domain.  The XML packaging used in the two cases is very
   similar.  The differences are the use of <recuser>$uname</recuser> and
   <recdomain>$udom</recdomain> in stored internal messages, compared
   with <recipient username="$uname:$udom">$email</recipient> in stored
   Domain Coordinator e-mail for the storage of information about
   recipients of the message/e-mail.
   
   =head1 FUNCTIONS
   
   =over 4
   
   =cut
   
 use strict;  use strict;
 use Apache::lonnet;  use Apache::lonnet;
 use HTML::TokeParser();  use HTML::TokeParser();
Line 598  sub user_normal_msg_raw { Line 629  sub user_normal_msg_raw {
        $baseurl, $attachmenturl, $toperm, $sentmessage, $symb, $restitle, $error)>:         $baseurl, $attachmenturl, $toperm, $sentmessage, $symb, $restitle, $error)>:
  Sends a message to the  $user at $domain, with subject $subject and message $message.   Sends a message to the  $user at $domain, with subject $subject and message $message.
   
       Additionally it will check if the user has a Forwarding address
       set, and send the message to that address instead
   
       returns
         - in array context a list of results for each message that was sent
         - in scalar context a space seperated list of results for each
              message sent
   
 =cut  =cut
   
 sub user_normal_msg {  sub user_normal_msg {
     my ($user,$domain,$subject,$message,$citation,$baseurl,$attachmenturl,      my ($user,$domain,$subject,$message,$citation,$baseurl,$attachmenturl,
  $toperm,$sentmessage,$symb,$restitle,$error)=@_;   $toperm,$sentmessage,$symb,$restitle,$error)=@_;
     my $status='';      my @status;
     my %userenv = &Apache::lonnet::get('environment',['msgforward'],      my %userenv = &Apache::lonnet::get('environment',['msgforward'],
                                        $domain,$user);                                         $domain,$user);
     my $msgforward=$userenv{'msgforward'};      my $msgforward=$userenv{'msgforward'};
     if ($msgforward) {      if ($msgforward) {
         foreach (split(/\,/,$msgforward)) {          foreach (split(/\,/,$msgforward)) {
     my ($forwuser,$forwdomain)=split(/\:/,$_);      my ($forwuser,$forwdomain)=split(/\:/,$_);
     $status.=      push(@status,
         &user_normal_msg_raw($forwuser,$forwdomain,$subject,$message,          &user_normal_msg_raw($forwuser,$forwdomain,$subject,$message,
      $citation,$baseurl,$attachmenturl,$toperm,       $citation,$baseurl,$attachmenturl,$toperm,
      undef,undef,$sentmessage,undef,$symb,$restitle,$error).' ';       undef,undef,$sentmessage,undef,$symb,$restitle,$error));
         }          }
     } else {      } else {
  $status=&user_normal_msg_raw($user,$domain,$subject,$message,   push(@status,&user_normal_msg_raw($user,$domain,$subject,$message,
      $citation,$baseurl,$attachmenturl,$toperm,       $citation,$baseurl,$attachmenturl,$toperm,
      undef,undef,$sentmessage,undef,$symb,$restitle,$error);       undef,undef,$sentmessage,undef,$symb,$restitle,$error));
     }      }
     return $status;      if (wantarray) {
           return @status;
       }
       return join(' ',@status);
 }  }
   
 sub store_sent_mail {  sub store_sent_mail {
Line 691  sub secapply { Line 733  sub secapply {
   
 =pod   =pod 
   
 =over 4  =item * B<decide_receiver($feedurl,$author,$question,$course,$policy,$defaultflag)>:
   
 =item *  
   
 decide_receiver($feedurl,$author,$question,$course,$policy,$defaultflag);  
   
 Arguments  Arguments
   $feedurl - /res/ url of resource (only need if $author is true)    $feedurl - /res/ url of resource (only need if $author is true)
Line 759  sub decide_receiver { Line 797  sub decide_receiver {
     return ($typestyle,%to);      return ($typestyle,%to);
 }  }
   
   =pod
   
   =back
   
   =cut
   
 1;  1;
 __END__  __END__
   

Removed from v.1.198  
changed lines
  Added in v.1.199


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>