--- loncom/interface/lonmsg.pm 2010/09/13 23:38:04 1.222.2.2 +++ loncom/interface/lonmsg.pm 2009/03/29 20:05:06 1.223 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines for messaging # -# $Id: lonmsg.pm,v 1.222.2.2 2010/09/13 23:38:04 raeburn Exp $ +# $Id: lonmsg.pm,v 1.223 2009/03/29 20:05:06 kaisler Exp $ # # Copyright Michigan State University Board of Trustees # @@ -203,8 +203,6 @@ use Apache::lonnet; use HTML::TokeParser(); use Apache::lonlocal; use Mail::Send; -use HTML::Entities; -use Encode; use LONCAPA qw(:DEFAULT :match); { @@ -486,8 +484,7 @@ sub sendnotification { my $protocol = $Apache::lonnet::protocol{$homeserver}; $protocol = 'http' if ($protocol ne 'https'); my $url = $protocol.'://'.&Apache::lonnet::hostname($homeserver). - '/adm/email?username='.$touname.'&domain='.$toudom. - '&display='.&escape($msgid); + '/adm/email?username='.$touname.'&domain='.$toudom; my ($sendtime,$shortsubj,$fromname,$fromdomain,$status,$fromcid, $symb,$error) = &Apache::lonmsg::unpackmsgid($msgid); my ($coursetext,$body,$bodybegin,$bodysubj,$bodyend); @@ -540,16 +537,13 @@ to access the full message.',$url); } if ($userenv{'notifywithhtml'} ne '') { my @htmlexcerpt = split(/,/,$userenv{'notifywithhtml'}); - my $htmlfree = &make_htmlfree($text); foreach my $addr (@recipients) { if ($blocked) { $body = $bodybegin."\n".$blocktext."\n".$bodyend; } else { - my $sendtext; + my $sendtext = $text; if (!grep/^\Q$addr\E/,@htmlexcerpt) { - $sendtext = $htmlfree; - } else { - $sendtext = $text; + $sendtext =~ s/\<\/*[^\>]+\>//gs; } $body = $bodybegin.$bodysubj.$sendtext.$bodyend; } @@ -559,25 +553,24 @@ to access the full message.',$url); if ($blocked) { $body = $bodybegin."\n".$blocktext."\n".$bodyend; } else { - my $htmlfree = &make_htmlfree($text); - $body = $bodybegin.$bodysubj.$htmlfree.$bodyend; + $text =~ s/\<\/*[^\>]+\>//gs; + $body = $bodybegin.$bodysubj.$text.$bodyend; } &sendemail($to,$subject,$body,$touname,$toudom,$user_lh); } } -sub make_htmlfree { - my ($text) = @_; - $text =~ s/\<\/*[^\>]+\>//gs; - $text = &HTML::Entities::decode($text); - $text = &Encode::encode('utf8',$text); - return $text; +sub mynewmail{ + &newmail(); + return $env{'user.mailcheck.status'}; } + sub newmail { if ((time-$env{'user.mailcheck.time'})>300) { my %what=&Apache::lonnet::get('email_status',['recnewemail']); &Apache::lonnet::appenv({'user.mailcheck.time'=>time}); + &Apache::lonnet::appenv({'user.mailcheck.status'=> $what{'recnewemail'}>0 ? 1 : 0}); if ($what{'recnewemail'}>0) { return 1; } } return 0;