--- loncom/lond 2002/08/09 10:05:00 1.87 +++ loncom/lond 2002/08/09 17:43:30 1.88 @@ -2,7 +2,7 @@ # The LearningOnline Network # lond "LON Daemon" Server (port "LOND" 5663) # -# $Id: lond,v 1.87 2002/08/09 10:05:00 www Exp $ +# $Id: lond,v 1.88 2002/08/09 17:43:30 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -952,7 +952,7 @@ sub make_new_child { my ($cmd,$fname)=split(/:/,$userinput); my ($udom,$uname,$ufile)=split(/\//,$fname); my $udir=propath($udom,$uname).'/userfiles'; - unless (-e $udir) { mkdir($udir); } + unless (-e $udir) { mkdir($udir,0770); } if (-e $udir) { $ufile=~s/^[\.\~]+//; $ufile=~s/\///g; @@ -1573,44 +1573,42 @@ sub getchat { my %hash; my $proname=&propath($cdom,$cname); my @entries=(); - if - (tie(%hash,'GDBM_File',"$proname/nohist_chatroom.db",&GDBM_READER(),0640)) - { - @entries=map { $_.':'.$hash{$_} } sort keys %hash; - untie %hash; + if (tie(%hash,'GDBM_File',"$proname/nohist_chatroom.db", + &GDBM_READER(),0640)) { + @entries=map { $_.':'.$hash{$_} } sort keys %hash; + untie %hash; } return @entries; } sub chatadd { - my ($cdom,$cname,$newchat)=@_; - my %hash; - my $proname=&propath($cdom,$cname); - my @entries=(); - if - (tie(%hash,'GDBM_File',"$proname/nohist_chatroom.db",&GDBM_WRCREAT(),0640)) - { - @entries=map { $_.':'.$hash{$_} } sort keys %hash; - my $time=time; - my ($lastid)=($entries[$#entries]=~/^(\w+)\:/); - my ($thentime,$idnum)=split(/\_/,$lastid); - my $newid=$time.'_000000'; - if ($thentime==$time) { - $idnum=~s/^0+//; - $idnum++; - $idnum=substr('000000'.$idnum,-6,6); - $newid=$time.'_'.$idnum; - } - $hash{$newid}=$newchat; - my $expired=$time-3600; - foreach (keys %hash) { - my ($thistime)=($_=~/(\d+)\_/); - if ($thistime<$expired) { - undef $hash{$_}; - } + my ($cdom,$cname,$newchat)=@_; + my %hash; + my $proname=&propath($cdom,$cname); + my @entries=(); + if (tie(%hash,'GDBM_File',"$proname/nohist_chatroom.db", + &GDBM_WRCREAT(),0640)) { + @entries=map { $_.':'.$hash{$_} } sort keys %hash; + my $time=time; + my ($lastid)=($entries[$#entries]=~/^(\w+)\:/); + my ($thentime,$idnum)=split(/\_/,$lastid); + my $newid=$time.'_000000'; + if ($thentime==$time) { + $idnum=~s/^0+//; + $idnum++; + $idnum=substr('000000'.$idnum,-6,6); + $newid=$time.'_'.$idnum; + } + $hash{$newid}=$newchat; + my $expired=$time-3600; + foreach (keys %hash) { + my ($thistime)=($_=~/(\d+)\_/); + if ($thistime<$expired) { + undef $hash{$_}; + } + } + untie %hash; } - untie %hash; - } } sub unsub {