fix it so that the node'c country is used as default for things like sh/c
authorminima <minima>
Mon, 20 Jan 2003 15:16:17 +0000 (15:16 +0000)
committerminima <minima>
Mon, 20 Jan 2003 15:16:17 +0000 (15:16 +0000)
cmd/show/configuration.pl
cmd/show/hftable.pl
cmd/show/vhftable.pl
perl/DXVars.pm.issue
perl/Prefix.pm
perl/cluster.pl

index 51c39dd07a8fa22733a429c69355cc26e498c561..9b6e4d2d6a3fc38506a55c977d41e0759e84383d 100644 (file)
@@ -55,7 +55,7 @@ if ($list[0] && $list[0] =~ /^NOD/) {
                        if (@list) {
                                next unless grep $node->call =~ /^$_/, @list;
                        } else {
-                               next unless $node->dxcc == $self->dxcc;
+                               next unless grep $node->dxcc == $_, @main::my_cc;
                        }
                }
                my $call = $node->call;
index 71d186337da54448fa0ee181c5614b94beb2b69e..4bcd3d19522da2e6f827a17253924709797dfcb8 100644 (file)
@@ -87,13 +87,8 @@ return (1, @out) if @out;
 
 # default prefixes
 unless (@pref) {                                       # no prefix or callsign, use default prefix
-       if ($self->dxcc >= 61 && $self->dxcc < 67) {
-               push @dxcc, [$_, 2] for (61..67);
-               push @pref, "GB";
-       } else {
-               push @dxcc, [$self->dxcc, 2];
-               push @pref, $self->call;
-       }
+       push @dxcc, [$_, 2] for @main::my_cc;
+       push @pref, $main::mycall;
 }
 
 # default date
index 421443a6fbfb343509ef80deff2e709797e4d087..9df5e4a70b31c1c6319a998687c24acc19006c1f 100644 (file)
@@ -59,13 +59,8 @@ return (1, @out) if @out;
 
 # default prefixes
 unless (@pref) {                                       # no prefix or callsign, use default prefix
-       if ($self->dxcc >= 61 && $self->dxcc < 67) {
-               push @dxcc, [$_, 2] for (61..67);
-               push @pref, "GB";
-       } else {
-               push @dxcc, [$self->dxcc, 2];
-               push @pref, $self->call;
-       }
+       push @dxcc, [$_, 2] for @main::my_cc;
+       push @pref, $main::mycall;
 }
 
 # default date
index 56b558fa52305a343879e8f10ef944a23beb93eb..1433d080b5ca8c175cccb12f0eff66b68daed41b 100644 (file)
@@ -17,7 +17,7 @@ require Exporter;
                 $clusterport $clusteraddr $debugfn 
                 $def_hopcount $data $system $cmd
                                $userfn $motd $local_cmd $mybbsaddr
-                $lang
+                $lang @my_cc
                                $pc50_interval $user_interval
                );
                           
@@ -53,6 +53,15 @@ $mybbsaddr = "G1TLH\@GB7TLH.#35.GBR.EU";
 # the default language (the key used must match the one in the Messages file)
 $lang = 'en';
 
+# the country codes that my node is located in
+# 
+# for example 'qw(EA EA8 EA9 EA0)' for Spain and all its islands.
+# if you leave this blank then it will use the country code for
+# your $mycall. This will suit 98% of sysops (including GB7 BTW).
+#
+
+@my_cc = qw();
+
 # the tcp address of the cluster this can be an address of an ethernet port
 # but this is more secure. For normal use this will be fine. 
 $clusteraddr = "localhost";
index 1e6e50c2d2e97baa42b7f8dc776b693113bf7d8f..a17966a3edc256f8ab22f5c685602f5bb6ebcaf7 100644 (file)
@@ -33,6 +33,30 @@ $db = undef;                                 # the DB_File handle
 $hits = $misses = $matchtotal = 1;             # cache stats
 $lrusize = 1000;                               # size of prefix LRU cache
 
+sub init
+{
+       my $r = load();
+       return $r if $r;
+
+       # fix up the node's default country codes
+       push @main::my_cc, (61..67) if !@main::my_cc && $main::mycall =~ /^GB/;
+       push @main::my_cc, qw(EA EA6 EA8 EA9) if !@main::my_cc && $main::mycall =~ /^E(ABCD)/;
+       push @main::my_cc, $main::mycall unless @main::my_cc;
+
+       my @c;
+       for (@main::my_cc) {
+               if (/^\d+$/) {
+                       push @c, $_;
+               } else {
+                       my @dxcc = extract($_);
+                       push @c, $dxcc[1]->dxcc if @dxcc > 1;
+               }
+       }
+       return "\@main::my_cc does not contain a valid prefix or callsign (" . join(',', @main::my_cc) . ")" unless @c;
+       @main::my_cc = @c;
+       return undef;
+}
+
 sub load
 {
        # untie every thing
index 0e321f2326efadff00b9ba70a19ee939037ffe85..5d102e4f80a92062b4b66ccd484bc7a290853aac 100755 (executable)
@@ -406,7 +406,7 @@ dbg("DXSpider Version $version, build $build started");
 
 # load Prefixes
 dbg("loading prefixes ...");
-my $r = Prefix::load();
+my $r = Prefix::init();
 confess $r if $r;
 dbg(USDB::init());