X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FDXUser.pm;h=4af135e7e795aefe0a7a39bc2f8a189828d442df;hb=a24cc09d8262093df92c767d3010c0a5fd6e42d7;hp=8890fae9185b4d990bf9f0d6737304d22b6088a6;hpb=2733a992ac8c3d315c110a2cc1984ea0a5e5d0ff;p=spider.git diff --git a/perl/DXUser.pm b/perl/DXUser.pm index 8890fae9..4af135e7 100644 --- a/perl/DXUser.pm +++ b/perl/DXUser.pm @@ -31,7 +31,7 @@ $dbm = undef; $filename = undef; $lastoperinterval = 60*24*60*60; $lasttime = 0; -$lrusize = 10000; +$lrusize = 5000; $tooold = 86400 * 365; # this marks an old user who hasn't given enough info to be useful $v3 = 0; our $maxconnlist = 3; # remember this many connection time (duration) [start, end] pairs @@ -108,6 +108,7 @@ my $json; startt => '0,Start Time,cldatetime', connlist => '1,Connections,parraydifft', width => '0,Preferred Width', + rbnseeme => '0,RBN See Me', ); #no strict; @@ -135,17 +136,19 @@ sub init { my $mode = shift; - $json = DXJSON->new->canonical(1); + $json = DXJSON->new->canonical(1); my $fn = "users"; $filename = localdata("$fn.v3j"); - unless (-e $filename || $mode == 2) { - LogDbg('DXUser', "New User File version $filename does not exist, running conversion from users.v3 or v2, please wait"); - system('/spider/perl/convert-users-v3-to-v3j.pl'); - init(1); - export(); - return; + unless (-e $filename || $mode == 2 ) { + if (-e localdata("$fn.v3") || -e localdata("$fn.v2")) { + LogDbg('DXUser', "New User File version $filename does not exist, running conversion from users.v3 or v2, please wait"); + system('/spider/perl/convert-users-v3-to-v3j.pl'); + init(1); + export(); + return; + } } - if (-e $filename || $mode == 2) { + if (-e $filename || $mode) { $lru = LRU->newbase("DXUser", $lrusize); if ($mode) { $dbm = tie (%u, 'DB_File', $filename, O_CREAT|O_RDWR, 0666, $DB_BTREE) or confess "can't open user file: $fn ($!) [rebuild it from user_json?]"; @@ -833,6 +836,16 @@ sub lastping $b->{$call} = shift if @_; return $b->{$call}; } + +sub registered +{ + my $self = shift; + if (exists $self->{registered}) { + return $self->{registered} || 0; + } + return ''; # to stop undef warnings +} + 1; __END__