fix registration checking on call+ssid
[spider.git] / cmd / dx.pl
index 919a34c08f16b8d2a195c3df7fe773e114ca892a..27099f243a2a5f9dba15ec8034da0f3f1d6ca296 100644 (file)
--- a/cmd/dx.pl
+++ b/cmd/dx.pl
@@ -18,8 +18,10 @@ my $valid = 0;
 my $localonly;
 my $oline = $line;
 
+#$DB::single=1;
+
 return (1, $self->msg('e5')) if $self->remotecmd || $self->inscript;
-return (1, $self->msg('e28')) unless $self->registered;
+return (1, $self->msg('e28')) unless $self->isregistered;
 
 my @bad;
 if (@bad = BadWords::check($line)) {   
@@ -60,7 +62,8 @@ my $ipaddr;
 my $addr = $self->hostname;
 
 if ($self->conn && $self->conn->peerhost) {
-       $ipaddr = $addr unless !is_ipaddr($addr) || $addr =~ /^127\./ || $addr =~ /^::[0-9a-f]+$/;
+#      $ipaddr = $addr unless !is_ipaddr($addr) || $addr =~ /^127\./ || $addr =~ /^::[0-9a-f]+$/;
+       $ipaddr = $addr; # force a PC61 
 } elsif ($self->inscript) {
        $ipaddr = "script";
 }
@@ -141,6 +144,8 @@ my $t = (int ($main::systime/60)) * 60;
 return (1, $self->msg('dup')) if Spot::dup($freq, $spotted, $t, $line, $spotter);
 my @spot = Spot::prepare($freq, $spotted, $t, $line, $spotter, $main::mycall, $ipaddr);
 
+#$DB::single = 1;
+
 if ($freq =~ /^69/ || $localonly) {
 
        # heaven forfend that we get a 69Mhz band :-)
@@ -149,18 +154,26 @@ if ($freq =~ /^69/ || $localonly) {
        }
 
        $self->dx_spot(undef, undef, @spot);
+
        return (1);
 } else {
-       if (@spot) {
-               # store it 
-               Spot::add(@spot);
-
                # send orf to the users
-               if ($ipaddr) {
-                       DXProt::send_dx_spot($self, DXProt::pc61($spotter, $freq, $spotted, $line, $ipaddr), @spot);
-               } else {
-                       DXProt::send_dx_spot($self, DXProt::pc11($spotter, $freq, $spotted, $line), @spot);
-               }
+       my $spot;
+
+       if ($ipaddr) {
+               $spot = DXProt::pc61($spotter, $freq, $spotted, $line, $ipaddr);
+       }
+       #else {
+       #       $spot = DXProt::pc11($spotter, $freq, $spotted, $line);
+       #}
+       
+       $self->dx_spot(undef, undef, @spot);
+       if ($self->isslugged) {
+               push @{$self->{sluggedpcs}}, [61, $spot, \@spot];
+       } else {
+               # store in spots database 
+               Spot::add(@spot);
+               DXProt::send_dx_spot($self, $spot, @spot);
        }
 }