projects
/
spider.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
add ST0 to prefixes
[spider.git]
/
perl
/
Spot.pm
diff --git
a/perl/Spot.pm
b/perl/Spot.pm
index ed78b40cefb7e22e8c55ffd546c95d50bca344bc..b8efd3d17c7af576ef387c908e41acfbb3eef8d5 100644
(file)
--- a/
perl/Spot.pm
+++ b/
perl/Spot.pm
@@
-3,7
+3,7
@@
#
# Copyright (c) - 1998 Dirk Koopman G1TLH
#
#
# Copyright (c) - 1998 Dirk Koopman G1TLH
#
-#
$Id$
+#
#
package Spot;
#
package Spot;
@@
-21,7
+21,8
@@
use QSL;
use strict;
use strict;
-use vars qw($fp $statp $maxspots $defaultspots $maxdays $dirprefix $duplth $dupage $filterdef $totalspots $hfspots $vhfspots $maxcalllth);
+use vars qw($fp $statp $maxspots $defaultspots $maxdays $dirprefix $duplth $dupage $filterdef
+ $totalspots $hfspots $vhfspots $maxcalllth $can_encode $use_db_for_search);
$fp = undef;
$statp = undef;
$fp = undef;
$statp = undef;
@@
-52,6
+53,7
@@
$filterdef = bless ([
], 'Filter::Cmd');
$totalspots = $hfspots = $vhfspots = 0;
], 'Filter::Cmd');
$totalspots = $hfspots = $vhfspots = 0;
+$use_db_for_search = 0;
# create a Spot Object
sub new
# create a Spot Object
sub new
@@
-159,7
+161,7
@@
sub prefix
# fix up the full spot data from the basic spot data
sub prepare
{
# fix up the full spot data from the basic spot data
sub prepare
{
- # $freq, $call, $t, $comment, $spotter = @_
+ # $freq, $call, $t, $comment, $spotter
, node, ip address
= @_
my @out = @_[0..4]; # just up to the spotter
# normalise frequency
my @out = @_[0..4]; # just up to the spotter
# normalise frequency
@@
-178,7
+180,9
@@
sub prepare
my @spt = Prefix::cty_data($out[4]);
push @out, $spt[0];
push @out, $_[5];
my @spt = Prefix::cty_data($out[4]);
push @out, $spt[0];
push @out, $_[5];
- return (@out, @spd[1,2], @spt[1,2], $spd[3], $spt[3]);
+ push @out, @spd[1,2], @spt[1,2], $spd[3], $spt[3];
+ push @out, $_[6] if $_[6] && is_ipaddr($_[6]);
+ return @out;
}
sub add
}
sub add
@@
-250,7
+254,7
@@
sub search
$to = $from + $maxspots if $to - $from > $maxspots || $to - $from <= 0;
$to = $from + $maxspots if $to - $from > $maxspots || $to - $from <= 0;
- if ($main::dbh) {
+ if ($main::dbh
&& $use_db_for_search
) {
return $main::dbh->spot_search($expr, $dayfrom, $dayto, $to-$from, $dxchan);
}
return $main::dbh->spot_search($expr, $dayfrom, $dayto, $to-$from, $dxchan);
}
@@
-402,10
+406,10
@@
sub dup
}
}
my $otext = $text;
}
}
my $otext = $text;
+# $text = Encode::encode("iso-8859-1", $text) if $main::can_encode && Encode::is_utf8($text, 1);
$text =~ s/^\+\w+\s*//; # remove leading LoTW callsign
$text =~ s/^\+\w+\s*//; # remove leading LoTW callsign
- $text = pack("C*", map {$_ & 127} unpack("C*", $text));
$text =~ s/\s{2,}[\dA-Z]?[A-Z]\d?$// if length $text > 24;
$text =~ s/\s{2,}[\dA-Z]?[A-Z]\d?$// if length $text > 24;
- $text =~ s/[
^\w]//g;
+ $text =~ s/[
\W\x00-\x2F\x7B-\xFF]//g; # tautology, just to make quite sure!
$text = substr($text, 0, $duplth) if length $text > $duplth;
my $ldupkey = "X$freq|$call|$by|$text";
my $t = DXDupe::find($ldupkey);
$text = substr($text, 0, $duplth) if length $text > $duplth;
my $ldupkey = "X$freq|$call|$by|$text";
my $t = DXDupe::find($ldupkey);