fix the problem now created with spots with no text
[spider.git] / perl / Spot.pm
index a57edbe81659a1b1b63bb269e93bf7e99e94f3b2..9a4b97249b46ab1516e50567aad96c4ede332a2c 100644 (file)
@@ -328,6 +328,9 @@ sub dup
        $d = int ($d / 60);
        $d *= 60;
 
+       # remove SSID or area
+       $by =~ s|[-/]\d+$||;
+       
        $freq = sprintf "%.1f", $freq;       # normalise frequency
        $call = substr($call, 0, $maxcalllth) if length $call > $maxcalllth;
 
@@ -340,13 +343,21 @@ sub dup
                        $text = "" if $cty == $try[0];
                }
        }
-       $text = substr($text, 0, $duplth) if length $text > $duplth; 
+       my $otext = $text;
        $text = pack("C*", map {$_ & 127} unpack("C*", $text));
        $text =~ s/[^\w]//g;
+       $text = substr($text, 0, $duplth) if length $text > $duplth; 
        my $ldupkey = "X$freq|$call|$by|$text";
        my $t = DXDupe::find($ldupkey);
        return 1 if $t && $t - $main::systime > 0;
-       DXDupe::add($ldupkey, $main::systime+$dupage);
+       if ($otext) {
+               DXDupe::add($ldupkey, $main::systime+$dupage);
+               $otext = substr($otext, 0, $duplth) if length $otext > $duplth; 
+               $ldupkey = "X$freq|$call|$by|$otext";
+               $t = DXDupe::find($ldupkey);
+               return 1 if $t && $t - $main::systime > 0;
+               DXDupe::add($ldupkey, $main::systime+$dupage);
+       }
 #      my $sdupkey = "X$freq|$call|$by";
 #      $t = DXDupe::find($sdupkey);
 #      return 1 if $t && $t - $main::systime > 0;