]> dxcluster.org Git - spider.git/commitdiff
disable checking in Chain as default
authorminima <minima>
Wed, 12 Mar 2003 17:30:03 +0000 (17:30 +0000)
committerminima <minima>
Wed, 12 Mar 2003 17:30:03 +0000 (17:30 +0000)
add prefix check for callsigns in QSL.pm

perl/Chain.pm
perl/Prefix.pm
perl/QSL.pm

index c065d17a62305b6c9fb224f0eb51a45b5ab34c1b..60266c755716d84d3aa625c90ad2b8a25e84b671 100644 (file)
@@ -15,7 +15,7 @@ use constant OBJ => 2;
 
 use vars qw($docheck);
 
-$docheck = 1;
+$docheck = 0;
                        
 sub _check
 {
index b43d9160085fc31c2a5500bdd22b0280f3dfed6f..91f7c5cee44a3753cf90256ca565f007c16d033e 100644 (file)
@@ -85,6 +85,11 @@ sub load
        return $out;
 }
 
+sub loaded
+{
+       return $db;
+}
+
 sub store
 {
        my ($k, $l);
index 0de926888d48ae195c33bce72b1f1e3e4b20932f..4d3bd1154fde0e8224cdcb1bd2806f390c781344 100644 (file)
@@ -12,6 +12,7 @@ use DXVars;
 use DXUtil;
 use DB_File;
 use DXDebug;
+use Prefix;
 
 use vars qw($VERSION $BRANCH);
 $VERSION = sprintf( "%d.%03d", q$Revision$ =~ /(\d+)\.(\d+)/ );
@@ -28,6 +29,8 @@ sub init
        my $mode = shift;
        my $ufn = "$main::root/data/$qslfn.v1";
 
+       Prefix::load() unless Prefix::loaded();
+       
        eval {
                require Storable;
        };
@@ -67,29 +70,38 @@ sub update
        my $line = shift;
        my $t = shift;
        my $by = shift;
+       my $changed;
+                       
+       foreach my $man (split /\b/, uc $line) {
+               my $tok;
                
-       my @tok = map {/^(?:HC|BUR|QRZ|HOME)/ || is_callsign($_) ? $_ : ()} split(/\b/, uc $line);
-       foreach my $man (@tok) {
-               if ($man =~ /^BUR/) {
-                       $man = 'BUREAU';
+               if (is_callsign($man)) {
+                       my @pre = Prefix::extract($man);
+                       $tok = $man if @pre && $pre[0] ne 'Q';
+               } elsif ($man =~ /^BUR/) {
+                       $tok = 'BUREAU';
                } elsif ($man eq 'HC' || $man =~ /^HOM/) {
-                       $man = 'HOME CALL';
+                       $tok = 'HOME CALL';
                } elsif ($man =~ /^QRZ/) {
-                       $man = 'QRZ.com';
+                       $tok = 'QRZ.com';
                }
-               my ($r) = grep {$_->[0] eq $man} @{$self->[1]};
-               if ($r) {
-                       $r->[1]++;
-                       if ($t > $r->[2]) {
-                               $r->[2] = $t;
-                               $r->[3] = $by;
+               if ($tok) {
+                       my ($r) = grep {$_->[0] eq $tok} @{$self->[1]};
+                       if ($r) {
+                               $r->[1]++;
+                               if ($t > $r->[2]) {
+                                       $r->[2] = $t;
+                                       $r->[3] = $by;
+                               }
+                               $changed++;
+                       } else {
+                               $r = [$tok, 1, $t, $by];
+                               unshift @{$self->[1]}, $r;
+                               $changed++;
                        }
-               } else {
-                       $r = [$man, 1, $t, $by];
-                       unshift @{$self->[1]}, $r;
                }
        }
-       $self->put;
+       $self->put if $changed;
 }
 
 sub get