[LON-CAPA-cvs] cvs: loncom /interface lonmsg.pm

www lon-capa-cvs@mail.lon-capa.org
Fri, 11 Oct 2002 20:04:34 -0000


www		Fri Oct 11 16:04:34 2002 EDT

  Modified files:              
    /loncom/interface	lonmsg.pm 
  Log:
  Mark if new email came in
  
  
Index: loncom/interface/lonmsg.pm
diff -u loncom/interface/lonmsg.pm:1.39 loncom/interface/lonmsg.pm:1.40
--- loncom/interface/lonmsg.pm:1.39	Mon Sep 16 16:06:12 2002
+++ loncom/interface/lonmsg.pm	Fri Oct 11 16:04:34 2002
@@ -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 @@
     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 @@
            '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 @@
         ['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('<html><head><title>EMail and Messaging</title></head>'.