--- loncom/interface/lonmsg.pm 2007/05/02 20:26:08 1.203 +++ loncom/interface/lonmsg.pm 2007/05/05 03:14:21 1.204 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines for messaging # -# $Id: lonmsg.pm,v 1.203 2007/05/02 20:26:08 albertel Exp $ +# $Id: lonmsg.pm,v 1.204 2007/05/05 03:14:21 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -163,6 +163,17 @@ sub packagemsg { if (defined($recipid)) { $result.= ''.$recipid.''; } + if ($env{'form.can_reply'} eq 'N') { + $result .= '1'; + } + if ($env{'form.reply_to_addr'}) { + my ($replytoname,$replytodom) = split(/:/,$env{'form.reply_to_addr'}); + if (!($replytoname eq $env{'user.name'} && $replytodom eq $env{'user.domain'})) { + if (&Apache::lonnet::homeserver($replytoname,$replytodom) ne 'no_host') { + $result .= ''.$env{'form.reply_to_addr'}.''; + } + } + } return ($msgid,$result); } @@ -551,14 +562,24 @@ sub user_crit_received { my $msgid=shift; my %message=&Apache::lonnet::get('critical',[$msgid]); my %contents=&unpackagemsg($message{$msgid},1); + my $destname = $contents{'sendername'}; + my $destdom = $contents{'senderdomain'}; + if ($contents{'replytoaddr'}) { + my ($repname,$repdom) = split(/:/,$contents{'replytoaddr'}); + if (&Apache::lonnet::homeserver($repname,$repdom) ne 'no_host') { + $destname = $repname; + $destdom = $repdom; + } + } my $status='rec: '.($contents{'sendback'}? - &user_normal_msg($contents{'sendername'},$contents{'senderdomain'}, - &mt('Receipt').': '.$env{'user.name'}.' '.&mt('at').' '.$env{'user.domain'}.', '.$contents{'subject'}, - &mt('User').' '.$env{'user.name'}.' '.&mt('at').' '.$env{'user.domain'}. - ' acknowledged receipt of message'."\n".' "'. - $contents{'subject'}.'"'."\n".&mt('dated').' '. - $contents{'time'}.".\n" - ):'no msg req'); + &user_normal_msg($destname,$destdom,&mt('Receipt').': '.$env{'user.name'}. + ' '.&mt('at').' '.$env{'user.domain'}.', '. + $contents{'subject'},&mt('User').' '.$env{'user.name'}. + ' '.&mt('at').' '.$env{'user.domain'}. + ' acknowledged receipt of message'."\n".' "'. + $contents{'subject'}.'"'."\n".&mt('dated').' '. + $contents{'time'}.".\n" + ):'no msg req'); $status.=' trans: '. &Apache::lonnet::put( 'nohist_email',{$contents{'msgid'} => $message{$msgid}});