--- loncom/interface/lonmsg.pm 2002/09/16 20:06:12 1.39 +++ loncom/interface/lonmsg.pm 2002/10/11 20:04:34 1.40 @@ -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.40 2002/10/11 20:04:34 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -119,6 +119,18 @@ 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); + &Apache::lonnet::logthis('Check Mail: '.$what{'recnewemail'}); + if ($what{'recnewemail'}>0) { return 1; } + } + return 0; +} + # =============================== Automated message to the author of a resource sub author_res_msg { @@ -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'.