X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FRBN.pm;h=e844b6d6bcba0c5597a948b2c5fc765520cd45d2;hb=ca5baf12f22e041cb14af595254af4ae88d82ae0;hp=7ad9093b7817831732debf8a84fc0ecca42237bd;hpb=cc49b8f8c2ec3a975c7ace3f5bd8679580288406;p=spider.git diff --git a/perl/RBN.pm b/perl/RBN.pm index 7ad9093b..e844b6d6 100644 --- a/perl/RBN.pm +++ b/perl/RBN.pm @@ -75,10 +75,11 @@ our $startup_delay = 5*60; # don't send anything out until this timer has expir # this is to allow the feed to "warm up" with duplicates # so that the "big rush" doesn't happen. -our $minspottime = 30*60; # the time between respots of a callsign - if a call is +our $respottime = 3*60; # the time between respots of a callsign - if a call is # still being spotted (on the same freq) and it has been # spotted before, it's spotted again after this time - # until the next minspottime has passed. + # until the next respottime has passed. + our $beacontime = 5*60; # same as minspottime, but for beacons (and shorter) @@ -90,9 +91,13 @@ our $limbotime = 5*60; # if there are fewer than $minqual candidates and $dwe # simply be that it is not in standard spot coverage. (ask G4PIQ # about this). +our $cachetime = 60*60; # The length of time spot data is cached + our $filterdef = $Spot::filterdef; # we use the same filter as the Spot system. Can't think why :-). my $spots; # the GLOBAL spot cache +my $qrg; # the GlOBAL (ephemeral) qrg cache (generated on re-read of cache) + my %runtime; # how long each channel has been running @@ -149,7 +154,7 @@ sub new $self->{norawhour} = 0; $self->{sort} = 'N'; $self->{lasttime} = $main::systime; - $self->{minspottime} = $minspottime; + $self->{respottime} = $respottime; $self->{beacontime} = $beacontime; $self->{showstats} = 0; $self->{pingint} = 0; @@ -167,9 +172,9 @@ sub start my $name = $user->{name}; # log it - my $host = $self->{conn}->peerhost; - $host ||= "unknown"; - $self->{hostname} = $host; + unless ($self->{hostname}) { + $self->{hostname} = $self->{conn}->peerhost || 'unknown'; + } $self->{name} = $name ? $name : $call; $self->state('prompt'); # a bit of room for further expansion, passwords etc @@ -254,6 +259,14 @@ sub normal return; } + # is it 'baddx' + if ($DXProt::baddx->in($call)) { + dbg("RBN: Bad DX spot '$call', ignored"); + dbg($line) if isdbg('nologchan'); + return; + } + + # remove all extraneous crap from the origin - just leave the base callsign my $norigin = basecall($origin); unless ($norigin) { @@ -342,22 +355,27 @@ sub normal # # 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}); + if (exists $seeme{$call} && (my $ref = $seeme{$call})) { + foreach my $rcall ( @$ref) { + my $uchan = DXChannel::get($rcall); + if ($uchan) { + 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); + } else { + LogDbg("RBN Someone is playing silly persons $rcall is not a user and cannot do 'seeme', ignored and reset"); + del_seeme($rcall); + } } - 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) { @@ -389,7 +407,7 @@ sub normal my $respot = 0; if ($cand && ref $cand) { if (@$cand <= CData) { - if ($self->{minspottime} > 0 && $now - $cand->[CTime] < $self->{minspottime}) { + if ($self->{respottime} > 0 && $now - $cand->[CTime] < $self->{respottime}) { dbg("RBN: key: '$sp' call: $call qrg: $qrg DUPE \@ ". atime(int $cand->[CTime])) if $dbgrbn && isdbg('rbn'); return; } @@ -444,7 +462,7 @@ sub send_dx_spot my $self = shift; my $quality = shift; my $cand = shift; - + ++$self->{norbn}; ++$self->{norbn10}; ++$self->{norbnhour}; @@ -854,7 +872,7 @@ sub per_10_minute next if $k =~ /^O\|/; next if $k =~ /^SKIM\|/; - if ($main::systime - $cand->[CTime] > $minspottime*2) { + if ($main::systime - $cand->[CTime] > $cachetime) { delete $spots->{$k}; ++$removed; } @@ -959,12 +977,24 @@ sub check_cache sub add_seeme { my $call = shift; - $seeme{$call} = 1; + my $base = basecall($call); + my $ref = $seeme{$base} || []; + push @$ref, $call unless grep $_ eq $call, @$ref; + $seeme{$base} = $ref; } sub del_seeme { my $call = shift; - delete $seeme{$call}; + my $base = basecall($call); + my $ref = $seeme{$base}; + return unless $ref && @$ref; + + @$ref = grep {$_ ne $call} @$ref; + if (@$ref) { + $seeme{$base} = $ref; + } else { + delete $seeme{basecall($call)}; + } } 1;