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

www lon-capa-cvs@mail.lon-capa.org
Fri, 28 Mar 2003 20:40:52 -0000


www		Fri Mar 28 15:40:52 2003 EDT

  Modified files:              
    /loncom	lond 
    /loncom/interface	lonchatfetch.pm 
  Log:
  Toward bug #1068
  
  
Index: loncom/lond
diff -u loncom/lond:1.122 loncom/lond:1.123
--- loncom/lond:1.122	Fri Mar 28 13:26:28 2003
+++ loncom/lond	Fri Mar 28 15:40:52 2003
@@ -2,7 +2,7 @@
 # The LearningOnline Network
 # lond "LON Daemon" Server (port "LOND" 5663)
 #
-# $Id: lond,v 1.122 2003/03/28 18:26:28 www Exp $
+# $Id: lond,v 1.123 2003/03/28 20:40:52 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -73,7 +73,7 @@
 my $status='';
 my $lastlog='';
 
-my $VERSION='$Revision: 1.122 $'; #' stupid emacs
+my $VERSION='$Revision: 1.123 $'; #' stupid emacs
 my $remoteVERSION;
 my $currenthostid;
 my $currentdomainid;
@@ -1842,6 +1842,17 @@
 	    &GDBM_READER(),0640)) {
 	@entries=map { $_.':'.$hash{$_} } sort keys %hash;
 	untie %hash;
+    }
+    $cutoff=time-60;
+    if (tie(%hash,'GDBM_File',"$proname/nohist_inchatroom.db",
+	    &GDBM_READER(),0640)) {
+	$hash{$uname.':'.$undom}=time;
+        foreach (sort keys %hash) {
+	    if ($hash{$_}>$cutoff) {
+		$entries[$#entries+1]='active_participant:'.$_;
+            }
+        }
+        untie %hash;
     }
     return @entries;
 }
Index: loncom/interface/lonchatfetch.pm
diff -u loncom/interface/lonchatfetch.pm:1.6 loncom/interface/lonchatfetch.pm:1.7
--- loncom/interface/lonchatfetch.pm:1.6	Mon Sep 16 16:15:10 2002
+++ loncom/interface/lonchatfetch.pm	Fri Mar 28 15:40:52 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Chat Fetching
 #
-# $Id: lonchatfetch.pm,v 1.6 2002/09/16 20:15:10 www Exp $
+# $Id: lonchatfetch.pm,v 1.7 2003/03/28 20:40:52 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -76,46 +76,50 @@
     }
     foreach (@entries) {
 	if ($include) {
-            my ($id,$msg)=split(/\:/,&Apache::lonnet::unescape($_));
-            chomp($msg);
-            my ($msgtime,$msgnum)=split(/\_/,$id);
-            my ($sdom,$snum,$anon,$contrib)=split(/\:/,
+	    my ($id,$msg,$uname)=split(/\:/,&Apache::lonnet::unescape($_));
+	    if ($id eq 'active_participant') {
+		$newstuff.='participant: '.$msg.' '.$uname;
+	    } else {
+		chomp($msg);
+		my ($msgtime,$msgnum)=split(/\_/,$id);
+		my ($sdom,$snum,$anon,$contrib)=split(/\:/,
                                               &Apache::lonnet::unescape($msg));
-            $contrib=&Apache::lonnet::unescape($contrib);
-            $contrib=~s/\n/\<br \/\>/g;
-	    $contrib=&Apache::lontexconvert::msgtexconverted($contrib);
-            $contrib=~s/\n/ /g;
-            $contrib=~s/\'/\&\#39\;/g;
-            my $sender='';
-            if ($seeid) {
-               $sender=&Apache::loncommon::plainname($snum,$sdom);
-               my $nick=&Apache::loncommon::nickname($snum,$sdom);
-               if (($nick) && ($nick ne $sender)) {
-		   $sender.=' '.$nick;
-               }
-	       if ($anon) { $sender.=' [Anon]' };
-            } elsif (!$anon) {
-               $sender=&Apache::loncommon::nickname($snum,$sdom);
-            } else {
-		$sender=&Apache::loncommon::screenname($snum,$sdom);
-                unless ($sender) { $sender="Anonymous"; }
-            }
-            $sender=~s/\'/\"/g;
-            my $color=$sender;
-            $color=~tr/a-j/0-9/;
-            $color=~tr/A-J/0-9/;
-            $color=~tr/k-t/0-9/;
-            $color=~tr/K-T/0-9/;
-            $color=~tr/u-z/0-5/;
-            $color=~tr/U-Z/0-5/;
-            $color=~s/\D//g;
-            $color=substr($color,0,6);
-            my $timestamp=localtime($msgtime);
-            my ($mhour,$mmin,$msec)=($timestamp=~/(\d\d)\:(\d\d)\:(\d\d)/);
-	    $newstuff.='<font color="#'.$color.'"><a name="'.$id.'"><b>'.
-                       $sender.'</b> ('.$mhour.':'.$mmin.':'.$msec.'): '.
-                       $contrib."</font><br>";
-            $bottomid=$id;
+		$contrib=&Apache::lonnet::unescape($contrib);
+		$contrib=~s/\n/\<br \/\>/g;
+		$contrib=&Apache::lontexconvert::msgtexconverted($contrib);
+		$contrib=~s/\n/ /g;
+		$contrib=~s/\'/\&\#39\;/g;
+		my $sender='';
+		if ($seeid) {
+		    $sender=&Apache::loncommon::plainname($snum,$sdom);
+		    my $nick=&Apache::loncommon::nickname($snum,$sdom);
+		    if (($nick) && ($nick ne $sender)) {
+			$sender.=' '.$nick;
+		    }
+		    if ($anon) { $sender.=' [Anon]' };
+		} elsif (!$anon) {
+		    $sender=&Apache::loncommon::nickname($snum,$sdom);
+		} else {
+		    $sender=&Apache::loncommon::screenname($snum,$sdom);
+		    unless ($sender) { $sender="Anonymous"; }
+		}
+		$sender=~s/\'/\"/g;
+		my $color=$sender;
+		$color=~tr/a-j/0-9/;
+		$color=~tr/A-J/0-9/;
+		$color=~tr/k-t/0-9/;
+		$color=~tr/K-T/0-9/;
+		$color=~tr/u-z/0-5/;
+		$color=~tr/U-Z/0-5/;
+		$color=~s/\D//g;
+		$color=substr($color,0,6);
+		my $timestamp=localtime($msgtime);
+		my ($mhour,$mmin,$msec)=($timestamp=~/(\d\d)\:(\d\d)\:(\d\d)/);
+		$newstuff.='<font color="#'.$color.'"><a name="'.$id.'"><b>'.
+		    $sender.'</b> ('.$mhour.':'.$mmin.':'.$msec.'): '.
+		    $contrib."</font><br>";
+		$bottomid=$id;
+	    }
         } else {
             $_=~/^(\w+)/;
             if ($1 eq $ENV{'form.lastid'}) { $include=1; }