X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FDXUser.pm;h=8890fae9185b4d990bf9f0d6737304d22b6088a6;hb=cbb522ef802d48991734a4ce803fa6ffa9774588;hp=1249b0b69f8842f323d13ff245a68774fcc7e452;hpb=dd73f6f34ce7f3e142e480dfb7153611d87f509b;p=spider.git diff --git a/perl/DXUser.pm b/perl/DXUser.pm index 1249b0b6..8890fae9 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; @@ -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', @@ -107,7 +107,7 @@ my $json; maxconnect => '1,Max Connections', startt => '0,Start Time,cldatetime', connlist => '1,Connections,parraydifft', - width => '0,Preferred Width' + width => '0,Preferred Width', ); #no strict; @@ -135,7 +135,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 +309,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); } @@ -678,7 +660,7 @@ sub wanttalk sub wantgrid { - return _want('grid', @_); + return _wantnot('grid', @_); } sub wantemail @@ -713,12 +695,12 @@ sub wantusstate sub wantdxcq { - return _want('dxcq', @_); + return _wantnot('dxcq', @_); } sub wantdxitu { - return _want('dxitu', @_); + return _wantnot('dxitu', @_); } sub wantgtk