projects
/
spider.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
RBN now with basic spots
[spider.git]
/
perl
/
DXUser.pm
diff --git
a/perl/DXUser.pm
b/perl/DXUser.pm
index 85a22195f9a08de314cf0389b194cb273d4db51c..91f3a3f02caab2900ac3deb4f21d2ea81ffa088e 100644
(file)
--- a/
perl/DXUser.pm
+++ b/
perl/DXUser.pm
@@
-149,6
+149,12
@@
my $ifh; # the input file, initialised by readinjson()
wantdxitu => '0,Show ITU Zone,yesno',
wantgtk => '0,Want GTK interface,yesno',
wantpc9x => '0,Want PC9X interface,yesno',
wantdxitu => '0,Show ITU Zone,yesno',
wantgtk => '0,Want GTK interface,yesno',
wantpc9x => '0,Want PC9X interface,yesno',
+ wantrbn => '0,Want RBN spots,yesno',
+ wantft => '0,Want RBN FT4/8,yesno',
+ wantcw => '0,Want RBN CW,yesno',
+ wantrtty => '0,Want RBN RTTY,yesno',
+ wantpsk => '0,Want RBN PSK,yesno',
+ wantbeacon => '0,Want (RBN) Beacon,yesno',
lastoper => '9,Last for/oper,cldatetime',
nothere => '0,Not Here Text',
registered => '9,Registered?,yesno',
lastoper => '9,Last for/oper,cldatetime',
nothere => '0,Not Here Text',
registered => '9,Registered?,yesno',
@@
-187,18
+193,28
@@
sub init
{
my $mode = shift;
{
my $mode = shift;
- my $
ufn
;
- my $
conve
rt;
-
+ my $
convert = "$main::root/perl/convert-users-v3-to-v4.pl"
;
+ my $
expo
rt;
+
$json = JSON->new()->canonical(1);
$filename = localdata("users.v4");
if (-e $filename || -e "$filename.n" || -e "$filename.o") {
$v4 = 1;
$json = JSON->new()->canonical(1);
$filename = localdata("users.v4");
if (-e $filename || -e "$filename.n" || -e "$filename.o") {
$v4 = 1;
- readinjson();
} else {
} else {
- die "User file $filename missing, please run convert-users-v3-to-v4.pl or copy a user_json backup from somewhere\n";
+# if (-e localdata('users.v3')) {
+# LogDbg('DXUser', "Converting " . localdata('users.v3') . " to new json version of users file, please wait");
+# if (-x $convert) {
+# system($convert);
+# ++$export;
+# }
+# }
+
+ die "User file $filename missing, please run $convert or copy a user_json backup from somewhere\n" unless -e "$filename.n" || -s $filename;
}
}
+ readinjson();
+ copy $filename, "$filename.n" unless -e "$filename.n";
+ export() if $export;
}
sub del_file
}
sub del_file
@@
-508,6
+524,7
@@
sub export
my $name = shift;
my $fn = $name || localdata("user_json"); # force use of local_data
my $name = shift;
my $fn = $name || localdata("user_json"); # force use of local_data
+ my $ta = [gettimeofday];
# save old ones
move "$fn.oooo", "$fn.ooooo" if -e "$fn.oooo";
# save old ones
move "$fn.oooo", "$fn.ooooo" if -e "$fn.oooo";
@@
-517,7
+534,7
@@
sub export
move "$fn", "$fn.o" if -e "$fn";
my $json = JSON->new;
move "$fn", "$fn.o" if -e "$fn";
my $json = JSON->new;
- $json->canonical(1);
+ $json->canonical(1);
;
my $count = 0;
my $err = 0;
my $count = 0;
my $err = 0;
@@
-527,10
+544,10
@@
sub export
my $key = 0;
my $val = undef;
foreach my $k (sort keys %u) {
my $key = 0;
my $val = undef;
foreach my $k (sort keys %u) {
- my $r =
$u{$k}
;
+ my $r =
get($k)
;
if ($r->{sort} eq 'U' && !$r->{priv} && $main::systime > $r->{lastin}+$tooold ) {
unless ($r->{lat} || $r->{long} || $r->{qra} || $r->{qth} || $r->{name}) {
if ($r->{sort} eq 'U' && !$r->{priv} && $main::systime > $r->{lastin}+$tooold ) {
unless ($r->{lat} || $r->{long} || $r->{qra} || $r->{qth} || $r->{name}) {
- LogDbg('
DXUser
', "DXUser::export deleting $k - too old, last in " . cldatetime($r->lastin) . " " . difft([$r->lastin, $main::systime]));
+ LogDbg('
export
', "DXUser::export deleting $k - too old, last in " . cldatetime($r->lastin) . " " . difft([$r->lastin, $main::systime]));
delete $u{$k};
++$del;
next;
delete $u{$k};
++$del;
next;
@@
-538,7
+555,7
@@
sub export
}
eval {$val = json_encode($r);};
if ($@) {
}
eval {$val = json_encode($r);};
if ($@) {
- LogDbg('
DXUser
', "DXUser::export error encoding call: $k $@");
+ LogDbg('
export
', "DXUser::export error encoding call: $k $@");
++$err;
next;
}
++$err;
next;
}
@@
-547,7
+564,8
@@
sub export
}
$fh->close;
}
}
$fh->close;
}
- my $s = qq{Exported users to $fn - $count Users $del Deleted $err Errors ('sh/log Export' for details)};
+ my $t = _diffms($ta);
+ my $s = qq{Exported users to $fn - $count Users $del Deleted $err Errors in $t mS ('sh/log Export' for details)};
LogDbg('DXUser', $s);
return $s;
}
LogDbg('DXUser', $s);
return $s;
}
@@
-824,6
+842,12
@@
sub is_ak1a
return $self->{sort} eq 'A';
}
return $self->{sort} eq 'A';
}
+sub is_rbn
+{
+ my $self = shift;
+ return $self->{sort} eq 'N'
+}
+
sub unset_passwd
{
my $self = shift;
sub unset_passwd
{
my $self = shift;
@@
-925,7
+949,7
@@
sub readinjson
# $ifh is "global" and should not be closed
# $ifh is "global" and should not be closed
-
dbg(
"DXUser::readinjson $count record headers read from $fn in ". _diffms($ta) . " mS");
+
LogDbg('DXUser',
"DXUser::readinjson $count record headers read from $fn in ". _diffms($ta) . " mS");
return $totusers = $count;
}
return $totusers = $count;
}
@@
-954,7
+978,7
@@
sub writeoutjson
}
$ofh->close;
}
$ofh->close;
-
dbg(
"DXUser::writeoutjson $count records written to $ofn in ". _diffms($ta) . " mS");
+
LogDbg('DXUser',
"DXUser::writeoutjson $count records written to $ofn in ". _diffms($ta) . " mS");
return $count;
}
1;
return $count;
}
1;