X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FDXUser.pm;h=e5afe25b183e4e6871b4f3bf2e66076463cc15db;hb=5d10d2095199b0d798926fa9e79a3f580c296b67;hp=bfc06b75801d34fb22348dd5b0860785175ca174;hpb=af8dd78669c2badfd6a6cf5e4724500a78da2d0d;p=spider.git diff --git a/perl/DXUser.pm b/perl/DXUser.pm index bfc06b75..e5afe25b 100644 --- a/perl/DXUser.pm +++ b/perl/DXUser.pm @@ -20,7 +20,7 @@ use File::Copy; use Data::Structure::Util qw(unbless); use Time::HiRes qw(gettimeofday tv_interval); use IO::File; -use JSON; +use DXJSON; use strict; @@ -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 @@ -95,7 +95,7 @@ my $json; wantcw => '0,Want RBN CW,yesno', wantrtty => '0,Want RBN RTTY,yesno', wantpsk => '0,Want RBN PSK,yesno', - wantbeacon => '0,Want (RBN) Beacon,yesno', + wantbeacon => '0,Want RBN Beacon,yesno', lastoper => '9,Last for/oper,cldatetime', nothere => '0,Not Here Text', registered => '9,Registered?,yesno', @@ -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,7 +136,7 @@ sub init { my $mode = shift; - $json = JSON->new->canonical(1); + $json = DXJSON->new->canonical(1); my $fn = "users"; $filename = localdata("$fn.v3j"); unless (-e $filename || $mode == 2) { @@ -309,31 +310,13 @@ sub put # thaw the user sub decode { - my $s = shift; - my $ref; - eval { $ref = $json->decode($s) }; - if ($ref && !$@) { - return bless $ref, 'DXUser'; - } else { - LogDbg('DXUser', "DXUser::json_decode: on '$s' $@"); - } - return undef; + return $json->decode(shift, __PACKAGE__); } # freeze the user sub encode { - my $ref = shift; - unbless($ref); - my $s; - - eval {$s = $json->encode($ref) }; - if ($s && !$@) { - bless $ref, 'DXUser'; - return $s; - } else { - LogDbg('DXUser', "DXUser::json_encode $ref->{call}, $@"); - } + return $json->encode(shift); }