From d6ef92100b25e721a15d00da498256853cc0acf2 Mon Sep 17 00:00:00 2001 From: minima Date: Mon, 20 Jan 2003 15:16:17 +0000 Subject: [PATCH] fix it so that the node'c country is used as default for things like sh/c --- cmd/show/configuration.pl | 2 +- cmd/show/hftable.pl | 9 ++------- cmd/show/vhftable.pl | 9 ++------- perl/DXVars.pm.issue | 11 ++++++++++- perl/Prefix.pm | 24 ++++++++++++++++++++++++ perl/cluster.pl | 2 +- 6 files changed, 40 insertions(+), 17 deletions(-) diff --git a/cmd/show/configuration.pl b/cmd/show/configuration.pl index 51c39dd0..9b6e4d2d 100644 --- a/cmd/show/configuration.pl +++ b/cmd/show/configuration.pl @@ -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; diff --git a/cmd/show/hftable.pl b/cmd/show/hftable.pl index 71d18633..4bcd3d19 100644 --- a/cmd/show/hftable.pl +++ b/cmd/show/hftable.pl @@ -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 diff --git a/cmd/show/vhftable.pl b/cmd/show/vhftable.pl index 421443a6..9df5e4a7 100644 --- a/cmd/show/vhftable.pl +++ b/cmd/show/vhftable.pl @@ -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 diff --git a/perl/DXVars.pm.issue b/perl/DXVars.pm.issue index 56b558fa..1433d080 100644 --- a/perl/DXVars.pm.issue +++ b/perl/DXVars.pm.issue @@ -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"; diff --git a/perl/Prefix.pm b/perl/Prefix.pm index 1e6e50c2..a17966a3 100644 --- a/perl/Prefix.pm +++ b/perl/Prefix.pm @@ -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 diff --git a/perl/cluster.pl b/perl/cluster.pl index 0e321f23..5d102e4f 100755 --- a/perl/cluster.pl +++ b/perl/cluster.pl @@ -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()); -- 2.43.0