version 1.86, 2002/08/08 13:45:21
|
version 1.89, 2002/08/09 18:18:36
|
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 1570 sub addline {
|
Line 1570 sub addline {
|
|
|
sub getchat { |
sub getchat { |
my ($cdom,$cname)=@_; |
my ($cdom,$cname)=@_; |
my @entries; |
my %hash; |
if (open(CHATIN,&propath($cdom,$cname).'/chatroom.txt')) { |
my $proname=&propath($cdom,$cname); |
while ($line=<CHATIN>) { push(@entries,$line); } |
my @entries=(); |
close(CHATIN); |
if (tie(%hash,'GDBM_File',"$proname/nohist_chatroom.db", |
return @entries; |
&GDBM_READER(),0640)) { |
|
@entries=map { $_.':'.$hash{$_} } sort keys %hash; |
|
untie %hash; |
} |
} |
return (); |
return @entries; |
} |
} |
|
|
sub chatadd { |
sub chatadd { |
my ($cdom,$cname,$newchat)=@_; |
my ($cdom,$cname,$newchat)=@_; |
my @entries=&getchat($cdom,$cname); |
my %hash; |
my $time=time; |
my $proname=&propath($cdom,$cname); |
my ($lastid)=($entries[$#entries]=~/^(\w+)\:/); |
my @entries=(); |
my ($thentime,$idnum)=split(/\_/,$lastid); |
if (tie(%hash,'GDBM_File',"$proname/nohist_chatroom.db", |
my $newid=$time.'_000000'; |
&GDBM_WRCREAT(),0640)) { |
if ($thentime==$time) { |
@entries=map { $_.':'.$hash{$_} } sort keys %hash; |
$idnum=~s/^0+//; |
my $time=time; |
$idnum++; |
my ($lastid)=($entries[$#entries]=~/^(\w+)\:/); |
$idnum=substr('000000'.$idnum,-6,6); |
my ($thentime,$idnum)=split(/\_/,$lastid); |
$newid=$time.'_'.$idnum; |
my $newid=$time.'_000000'; |
} |
if ($thentime==$time) { |
push (@entries,$newid.':'.$newchat."\n"); |
$idnum=~s/^0+//; |
my $expired=$time-3600; |
$idnum++; |
open(CHATOUT,'>'.&propath($cdom,$cname).'/chatroom.txt'); |
$idnum=substr('000000'.$idnum,-6,6); |
foreach (@entries) { |
$newid=$time.'_'.$idnum; |
my ($thistime)=($_=~/(\d+)\_/); |
} |
if ($thistime>$expired) { |
$hash{$newid}=$newchat; |
print CHATOUT $_; |
my $expired=$time-3600; |
} |
foreach (keys %hash) { |
|
my ($thistime)=($_=~/(\d+)\_/); |
|
if ($thistime<$expired) { |
|
delete $hash{$_}; |
|
} |
|
} |
|
untie %hash; |
} |
} |
close(CHATOUT); |
|
} |
} |
|
|
sub unsub { |
sub unsub { |