Diff for /loncom/lond between versions 1.87 and 1.88

version 1.87, 2002/08/09 10:05:00 version 1.88, 2002/08/09 17:43:30
Line 952  sub make_new_child { Line 952  sub make_new_child {
                       my ($cmd,$fname)=split(/:/,$userinput);                        my ($cmd,$fname)=split(/:/,$userinput);
       my ($udom,$uname,$ufile)=split(/\//,$fname);        my ($udom,$uname,$ufile)=split(/\//,$fname);
                       my $udir=propath($udom,$uname).'/userfiles';                        my $udir=propath($udom,$uname).'/userfiles';
                       unless (-e $udir) { mkdir($udir); }                        unless (-e $udir) { mkdir($udir,0770); }
                        if (-e $udir) {                         if (-e $udir) {
                        $ufile=~s/^[\.\~]+//;                         $ufile=~s/^[\.\~]+//;
                        $ufile=~s/\///g;                         $ufile=~s/\///g;
Line 1573  sub getchat { Line 1573  sub getchat {
     my %hash;      my %hash;
     my $proname=&propath($cdom,$cname);      my $proname=&propath($cdom,$cname);
     my @entries=();      my @entries=();
     if       if (tie(%hash,'GDBM_File',"$proname/nohist_chatroom.db",
      (tie(%hash,'GDBM_File',"$proname/nohist_chatroom.db",&GDBM_READER(),0640))      &GDBM_READER(),0640)) {
     {   @entries=map { $_.':'.$hash{$_} } sort keys %hash;
  @entries=map { $_.':'.$hash{$_} } sort keys %hash;   untie %hash;
          untie %hash;  
     }      }
     return @entries;      return @entries;
 }  }
   
 sub chatadd {  sub chatadd {
   my ($cdom,$cname,$newchat)=@_;      my ($cdom,$cname,$newchat)=@_;
   my %hash;      my %hash;
   my $proname=&propath($cdom,$cname);      my $proname=&propath($cdom,$cname);
   my @entries=();      my @entries=();
   if       if (tie(%hash,'GDBM_File',"$proname/nohist_chatroom.db",
   (tie(%hash,'GDBM_File',"$proname/nohist_chatroom.db",&GDBM_WRCREAT(),0640))      &GDBM_WRCREAT(),0640)) {
    {   @entries=map { $_.':'.$hash{$_} } sort keys %hash;
     @entries=map { $_.':'.$hash{$_} } sort keys %hash;   my $time=time;
     my $time=time;   my ($lastid)=($entries[$#entries]=~/^(\w+)\:/);
     my ($lastid)=($entries[$#entries]=~/^(\w+)\:/);   my ($thentime,$idnum)=split(/\_/,$lastid);
     my ($thentime,$idnum)=split(/\_/,$lastid);   my $newid=$time.'_000000';
     my $newid=$time.'_000000';   if ($thentime==$time) {
     if ($thentime==$time) {      $idnum=~s/^0+//;
  $idnum=~s/^0+//;      $idnum++;
         $idnum++;      $idnum=substr('000000'.$idnum,-6,6);
         $idnum=substr('000000'.$idnum,-6,6);      $newid=$time.'_'.$idnum;
         $newid=$time.'_'.$idnum;   }
     }   $hash{$newid}=$newchat;
     $hash{$newid}=$newchat;   my $expired=$time-3600;
     my $expired=$time-3600;   foreach (keys %hash) {
     foreach (keys %hash) {      my ($thistime)=($_=~/(\d+)\_/);
         my ($thistime)=($_=~/(\d+)\_/);      if ($thistime<$expired) {
         if ($thistime<$expired) {   undef $hash{$_};
    undef $hash{$_};      }
         }   }
    untie %hash;
     }      }
     untie %hash;  
    }  
 }  }
   
 sub unsub {  sub unsub {

Removed from v.1.87  
changed lines
  Added in v.1.88


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>