version 1.201, 2007/05/01 18:40:57
|
version 1.203, 2007/05/02 20:26:08
|
Line 78 use LONCAPA qw(:DEFAULT :match);
|
Line 78 use LONCAPA qw(:DEFAULT :match);
|
|
|
sub packagemsg { |
sub packagemsg { |
my ($subject,$message,$citation,$baseurl,$attachmenturl, |
my ($subject,$message,$citation,$baseurl,$attachmenturl, |
$recuser,$recdomain,$msgid,$type,$crsmsgid,$symb,$error)=@_; |
$recuser,$recdomain,$msgid,$type,$crsmsgid,$symb,$error,$recipid)=@_; |
$message =&HTML::Entities::encode($message,'<>&"'); |
$message =&HTML::Entities::encode($message,'<>&"'); |
$citation=&HTML::Entities::encode($citation,'<>&"'); |
$citation=&HTML::Entities::encode($citation,'<>&"'); |
$subject =&HTML::Entities::encode($subject,'<>&"'); |
$subject =&HTML::Entities::encode($subject,'<>&"'); |
Line 160 sub packagemsg {
|
Line 160 sub packagemsg {
|
} |
} |
} |
} |
} |
} |
|
if (defined($recipid)) { |
|
$result.= '<recipid>'.$recipid.'</recipid>'; |
|
} |
return ($msgid,$result); |
return ($msgid,$result); |
} |
} |
|
|
Line 445 sub store_instructor_comment {
|
Line 448 sub store_instructor_comment {
|
|
|
sub user_crit_msg_raw { |
sub user_crit_msg_raw { |
my ($user,$domain,$subject,$message,$sendback,$toperm,$sentmessage, |
my ($user,$domain,$subject,$message,$sendback,$toperm,$sentmessage, |
$nosentstore)=@_; |
$nosentstore,$recipid)=@_; |
# Check if allowed missing |
# Check if allowed missing |
my ($status,$packed_message); |
my ($status,$packed_message); |
my $msgid='undefined'; |
my $msgid='undefined'; |
Line 453 sub user_crit_msg_raw {
|
Line 456 sub user_crit_msg_raw {
|
my $text=$message; |
my $text=$message; |
my $homeserver=&Apache::lonnet::homeserver($user,$domain); |
my $homeserver=&Apache::lonnet::homeserver($user,$domain); |
if ($homeserver ne 'no_host') { |
if ($homeserver ne 'no_host') { |
($msgid,$packed_message)=&packagemsg($subject,$message); |
($msgid,$packed_message)=&packagemsg($subject,$message,undef,undef, |
|
undef,undef,undef,undef,undef,undef,undef, |
|
undef,$recipid); |
if ($sendback) { $packed_message.='<sendback>true</sendback>'; } |
if ($sendback) { $packed_message.='<sendback>true</sendback>'; } |
$status=&Apache::lonnet::critical( |
$status=&Apache::lonnet::critical( |
'put:'.$domain.':'.$user.':critical:'. |
'put:'.$domain.':'.$user.':critical:'. |
Line 499 sub user_crit_msg_raw {
|
Line 504 sub user_crit_msg_raw {
|
|
|
=pod |
=pod |
|
|
=item * B<user_crit_msg($user, $domain, $subject, $message, $sendback, $nosentstore)>: |
=item * B<user_crit_msg($user, $domain, $subject, $message, $sendback, $nosentstore,$recipid)>: |
Sends a critical message $message to the $user at $domain. If $sendback |
Sends a critical message $message to the $user at $domain. If $sendback |
is true, a receipt will be sent to the current user when $user receives |
is true, a receipt will be sent to the current user when $user receives |
the message. |
the message. |
Line 516 sub user_crit_msg_raw {
|
Line 521 sub user_crit_msg_raw {
|
|
|
sub user_crit_msg { |
sub user_crit_msg { |
my ($user,$domain,$subject,$message,$sendback,$toperm,$sentmessage, |
my ($user,$domain,$subject,$message,$sendback,$toperm,$sentmessage, |
$nosentstore)=@_; |
$nosentstore,$recipid)=@_; |
my @status; |
my @status; |
my %userenv = &Apache::lonnet::get('environment',['msgforward'], |
my %userenv = &Apache::lonnet::get('environment',['msgforward'], |
$domain,$user); |
$domain,$user); |
Line 526 sub user_crit_msg {
|
Line 531 sub user_crit_msg {
|
my ($forwuser,$forwdomain)=split(/\:/,$addr); |
my ($forwuser,$forwdomain)=split(/\:/,$addr); |
push(@status, |
push(@status, |
&user_crit_msg_raw($forwuser,$forwdomain,$subject,$message, |
&user_crit_msg_raw($forwuser,$forwdomain,$subject,$message, |
$sendback,$toperm,$sentmessage,$nosentstore)); |
$sendback,$toperm,$sentmessage,$nosentstore, |
|
$recipid)); |
} |
} |
} else { |
} else { |
push(@status, |
push(@status, |
&user_crit_msg_raw($user,$domain,$subject,$message,$sendback, |
&user_crit_msg_raw($user,$domain,$subject,$message,$sendback, |
$toperm,$sentmessage,$nosentstore)); |
$toperm,$sentmessage,$nosentstore,$recipid)); |
} |
} |
if (wantarray) { |
if (wantarray) { |
return @status; |
return @status; |
Line 570 sub user_crit_received {
|
Line 576 sub user_crit_received {
|
sub user_normal_msg_raw { |
sub user_normal_msg_raw { |
my ($user,$domain,$subject,$message,$citation,$baseurl,$attachmenturl, |
my ($user,$domain,$subject,$message,$citation,$baseurl,$attachmenturl, |
$toperm,$currid,$newid,$sentmessage,$crsmsgid,$symb,$restitle, |
$toperm,$currid,$newid,$sentmessage,$crsmsgid,$symb,$restitle, |
$error,$nosentstore)=@_; |
$error,$nosentstore,$recipid)=@_; |
# Check if allowed missing |
# Check if allowed missing |
my ($status,$packed_message); |
my ($status,$packed_message); |
my $msgid='undefined'; |
my $msgid='undefined'; |
Line 581 sub user_normal_msg_raw {
|
Line 587 sub user_normal_msg_raw {
|
($msgid,$packed_message)= |
($msgid,$packed_message)= |
&packagemsg($subject,$message,$citation,$baseurl, |
&packagemsg($subject,$message,$citation,$baseurl, |
$attachmenturl,$user,$domain,$currid, |
$attachmenturl,$user,$domain,$currid, |
undef,$crsmsgid,$symb,$error); |
undef,$crsmsgid,$symb,$error,$recipid); |
|
|
# Store in user folder |
# Store in user folder |
$status=&Apache::lonnet::critical( |
$status=&Apache::lonnet::critical( |
Line 633 sub user_normal_msg_raw {
|
Line 639 sub user_normal_msg_raw {
|
|
|
=item * B<user_normal_msg($user, $domain, $subject, $message, $citation, |
=item * B<user_normal_msg($user, $domain, $subject, $message, $citation, |
$baseurl, $attachmenturl, $toperm, $sentmessage, $symb, $restitle, |
$baseurl, $attachmenturl, $toperm, $sentmessage, $symb, $restitle, |
$error,$nosentstore)>: |
$error,$nosentstore,$recipid)>: |
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 |
Additionally it will check if the user has a Forwarding address |
Line 648 sub user_normal_msg_raw {
|
Line 654 sub user_normal_msg_raw {
|
|
|
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,$nosentstore)=@_; |
$toperm,$sentmessage,$symb,$restitle,$error,$nosentstore,$recipid)=@_; |
my @status; |
my @status; |
my %userenv = &Apache::lonnet::get('environment',['msgforward'], |
my %userenv = &Apache::lonnet::get('environment',['msgforward'], |
$domain,$user); |
$domain,$user); |
Line 660 sub user_normal_msg {
|
Line 666 sub user_normal_msg {
|
&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, |
undef,undef,$sentmessage,undef,$symb, |
$restitle,$error,$nosentstore)); |
$restitle,$error,$nosentstore,$recipid)); |
} |
} |
} else { |
} else { |
push(@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, |
undef,undef,$sentmessage,undef,$symb, |
$restitle,$error,$nosentstore)); |
$restitle,$error,$nosentstore,$recipid)); |
} |
} |
if (wantarray) { |
if (wantarray) { |
return @status; |
return @status; |
Line 708 sub store_sent_mail {
|
Line 714 sub store_sent_mail {
|
return $status; |
return $status; |
} |
} |
|
|
|
sub store_recipients { |
|
my ($subject,$sendername,$senderdom,$reciphash) = @_; |
|
my $context = &get_course_context(); |
|
my $now = time(); |
|
my $msgcount = &get_uniq(); |
|
my $recipid = |
|
&buildmsgid($now,$subject,$sendername,$senderdom,$msgcount,$context,$$); |
|
my %recipinfo = ( |
|
$recipid => $reciphash, |
|
); |
|
my $status = &Apache::lonnet::put('nohist_emailrecip',\%recipinfo, |
|
$senderdom,$sendername); |
|
if ($status eq 'ok') { |
|
return ($recipid,$status); |
|
} else { |
|
return (undef,$status); |
|
} |
|
} |
|
|
# =============================================================== Folder suffix |
# =============================================================== Folder suffix |
|
|
sub foldersuffix { |
sub foldersuffix { |