--- loncom/interface/lonmsg.pm 2002/09/16 20:06:12 1.39 +++ loncom/interface/lonmsg.pm 2002/10/25 13:55:45 1.42 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines for messaging # -# $Id: lonmsg.pm,v 1.39 2002/09/16 20:06:12 albertel Exp $ +# $Id: lonmsg.pm,v 1.42 2002/10/25 13:55:45 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -119,6 +119,17 @@ sub unpackmsgid { return ($sendtime,$shortsubj,$fromname,$fromdomain,$status{$msgid}); } +# ============================================================= Check for email + +sub newmail { + if ((time-$ENV{'user.mailcheck.time'})>300) { + my %what=&Apache::lonnet::get('email_status',['recnewemail']); + &Apache::lonnet::appenv('user.mailcheck.time'=>time); + if ($what{'recnewemail'}>0) { return 1; } + } + return 0; +} + # =============================== Automated message to the author of a resource sub author_res_msg { @@ -199,9 +210,10 @@ sub user_crit_received { &user_normal_msg($contents{'sendername'},$contents{'senderdomain'}, 'Receipt: '.$ENV{'user.name'}.' at '.$ENV{'user.domain'}, 'User '.$ENV{'user.name'}.' at '.$ENV{'user.domain'}. - ' acknowledged receipt of message "'. - $contents{'subject'}.'" dated '.$contents{'time'}.".\n\n" - .'Message ID: '.$contents{'msgid'}):'no msg req'); + ' acknowledged receipt of message'."\n".' "'. + $contents{'subject'}.'"'."\n".'dated '. + $contents{'time'}.".\n" + ):'no msg req'); $status.=' trans: '. &Apache::lonnet::put( 'nohist_email',{$contents{'msgid'} => $message{$msgid}}); @@ -229,6 +241,8 @@ sub user_normal_msg_raw { 'put:'.$domain.':'.$user.':nohist_email:'. &Apache::lonnet::escape($msgid).'='. &Apache::lonnet::escape($message),$homeserver); + &Apache::lonnet::put + ('email_status',{'recnewemail'=>time},$domain,$user); } else { $status='no_host'; } @@ -582,6 +596,8 @@ sub handler { ['display','replyto','forward','markread','markdel','markunread', 'sendreply','compose','sendmail','critical','recname','recdom']); +# ------------------------------------------------------ They checked for email + &Apache::lonnet::put('email_status',{'recnewemail'=>0}); # --------------------------------------------------------------- Render Output $r->print('EMail and Messaging'.