X-Git-Url: http://www.dxcluster.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FRBN.pm;h=7ad9093b7817831732debf8a84fc0ecca42237bd;hb=cc49b8f8c2ec3a975c7ace3f5bd8679580288406;hp=ec9f39467942ef2014557938a393f44482068164;hpb=b84cf84a242ce805eef4b5406bacb9016274243d;p=spider.git diff --git a/perl/RBN.pm b/perl/RBN.pm index ec9f3946..7ad9093b 100644 --- a/perl/RBN.pm +++ b/perl/RBN.pm @@ -107,6 +107,9 @@ my $json; my $noinrush = 0; # override the inrushpreventor if set our $maxdeviants = 5; # the number of deviant QRGs to record for skimmer records +our %seeme; # the list of users that want to see themselves + + sub init { $json = DXJSON->new; @@ -331,6 +334,30 @@ sub normal my $nqrg = nearest(1, $qrg * 10); # normalised to nearest Khz my $sp = "$call|$nqrg"; # hopefully the skimmers will be calibrated at least this well! + # deal with the unix time + my ($hh,$mm) = $t =~ /(\d\d)(\d\d)Z$/; + my $utz = $hh*3600 + $mm*60 + $main::systime_daystart; # possible issue with late spot from previous day + $utz -= 86400 if $utz > $now+3600; # too far ahead, drag it back one day + + # + # But before we do anything, if this call is in the seeme hash then just send the spot to them + # + if (exists $seeme{$call} && (my $scall = $seeme{$call})) { + my $uchan = DXChannel::get($call); + if ($uchan->is_user) { + if (isdbg('seeme')) { + dbg("seeme: $line"); + dbg( qq{seemme:decode or:$origin qr:$qrg ca:$call mo:$mode s:$s m:$m sp:$spd u:$u sort:$sort t:$t tx:$tx qra:$qra}); + } + my @s = Spot::prepare($qrg, $call, $utz, sprintf("%-3s %2ddB **SEEME**", $mode, $s), $origin.'-#'); + my $buf = $uchan->format_dx_spot(@s); + dbg("seeme: result '$buf'") if isdbg('seeme'); + $uchan->local_send('S', $buf) if $scall; + } else { + LogDbg("RBN Someone is playing silly persons $call is not a user and cannot do 'seeme', ignored and reset"); + delete $seeme{$call}; + } + } # find it? my $cand = $spots->{$sp}; unless ($cand) { @@ -386,11 +413,6 @@ sub normal return unless $noinrush || $self->{inrushpreventor} < $main::systime; # build up a new record and store it in the buildup - # deal with the unix time - my ($hh,$mm) = $t =~ /(\d\d)(\d\d)Z$/; - my $utz = $hh*3600 + $mm*60 + $main::systime_daystart; # possible issue with late spot from previous day - $utz -= 86400 if $utz > $now+3600; # too far ahead, drag it back one day - # create record and add into the buildup my $r = [$origin, nearest(.1, $qrg), $call, $mode, $s, $t, $utz, $respot, $u]; my @s = Spot::prepare($r->[RQrg], $r->[RCall], $r->[RUtz], '', $r->[ROrigin]); @@ -467,7 +489,6 @@ sub dx_spot my $quality = shift; my $cand = shift; my $call = $dxchan->{call}; - my $seeme = $dxchan->user->rbnseeme(); my $strength = 100; # because it could if we talk about FTx my $saver; my %zone; @@ -495,12 +516,6 @@ sub dx_spot ++$zone{$s->[SZone]}; # save the spotter's zone - # if the 'see me' flag is set, then show all the spots without further adornment (see set/rbnseeme for more info) - if ($seeme) { - send_final($dxchan, $s); - next; - } - # save the lowest strength one if ($r->[RStrength] < $strength) { $strength = $r->[RStrength]; @@ -567,7 +582,7 @@ sub send_final $buf = $dxchan->format_dx_spot(@$saver); $saver->[SOrigin] = $call; } - $dxchan->local_send('N', $buf); + $dxchan->local_send('R', $buf); } # per second @@ -941,4 +956,15 @@ sub check_cache return undef; } +sub add_seeme +{ + my $call = shift; + $seeme{$call} = 1; +} + +sub del_seeme +{ + my $call = shift; + delete $seeme{$call}; +} 1;