[LON-CAPA-cvs] cvs: loncom /interface loncommon.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Tue, 31 Oct 2006 22:05:54 -0000
albertel Tue Oct 31 17:05:54 2006 EDT
Modified files:
/loncom/interface loncommon.pm
Log:
- add ne accessor to get emails for a specific user
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.465 loncom/interface/loncommon.pm:1.466
--- loncom/interface/loncommon.pm:1.465 Fri Oct 13 18:03:26 2006
+++ loncom/interface/loncommon.pm Tue Oct 31 17:05:53 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.465 2006/10/13 22:03:26 albertel Exp $
+# $Id: loncommon.pm,v 1.466 2006/10/31 22:05:53 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2067,6 +2067,25 @@
}
}
+sub getemails {
+ my ($uname,$udom)=@_;
+ if ($udom eq 'public' && $uname eq 'public') {
+ return;
+ }
+ my $id=$uname.':'.$udom;
+ my ($names,$cached)=&Apache::lonnet::is_cached_new('emailscache',$id);
+ if ($cached) {
+ return %{$names};
+ } else {
+ my %loadnames=&Apache::lonnet::get('environment',
+ ['notification','critnotification',
+ 'permanentemail'],
+ $udom,$uname);
+ &Apache::lonnet::do_cache_new('emailscache',$id,\%loadnames);
+ return %loadnames;
+ }
+}
+
# ------------------------------------------------------------------ Screenname
=pod