added the ability for HDB to use sh/qrz remotely

This commit is contained in:
minima 2003-03-12 18:38:21 +00:00
parent 97ed915623
commit 51fc2b9134
5 changed files with 39 additions and 4 deletions

View File

@ -2,6 +2,11 @@
1. added HC and QRZ.com to possible QSL locations, if you want to pick up
historical info (ie start again), run create_qsl.pl after update and restart
the node (which you will need to do anyway).
2. changed the dbcreate command so that you can say:
dbcreate dxqsl cmd show/dxqsl
which will allow local and remote users to execute commands as though they
are Databases. You can also include these databases in chains. What you do
with this, is ofcourse a moot question.
11Mar03=======================================================================
1. Changed the name of show/qsl to show/dxqsl.
2. Alter Commands_en.hlp to match new name and issue manual updates (g0vgs)

View File

@ -378,6 +378,7 @@ in the system. It is also aliased to SHOW/COMMAND.
=== 9^DBCREATE <name>^Create a database entry
=== 9^DBCREATE <name> chain <name> [<name>..]^Create a chained database entry
=== 9^DBCREATE <name> remote <node>^Create a remote database entry
=== 9^DBCREATE <name> cmd <dxspider command>^make a local command available as a DB
DBCREATE allows you to define a database in the system. It doesn't actually
create anything, just defines it.
@ -430,6 +431,16 @@ to allow
to work as they may be used to.
You can also make local commands available as 'pseudo' databases. You
can therefore make spider special commands available as a database. I
imagine that this will be primarily useful for remote access from
legacy nodes. For example:-
DBCREATE dxqsl cmd show/dxqsl
You also use one of these databases in a chain. This may be useful
locally.
See DBIMPORT for the importing of existing AK1A format data to databases.
See DBSHOW for generic database enquiry

View File

@ -10,7 +10,7 @@ my @out;
my $f;
foreach $f (values %DXDb::avail) {
push @out, "DB Name Location Chain" unless @out;
push @out, sprintf "%-15s %-10s %s", $f->name, $f->remote ? $f->remote : "Local", $f->chain ? parray($f->chain) : "";
push @out, "DB Name Location Cmd Chain" unless @out;
push @out, sprintf "%-15s %-10s %-15s %s", $f->name, $f->remote ? $f->remote : "Local", ($f->localcmd || ""), $f->chain ? parray($f->chain) : "";
}
return (1, @out);

View File

@ -14,12 +14,17 @@ return (1, $self->msg('db6', $name)) if DXDb::getdesc($name);
my $remote;
my $chain;
my $cmd;
while (@f) {
my $f = lc shift @f;
if ($f eq 'remote') {
$remote = uc shift @f if @f;
next;
}
if ($f eq 'cmd') {
$cmd = lc shift @f if @f;
next;
}
if ($f eq 'chain') {
if (@f) {
$chain = [ @f ];
@ -27,6 +32,6 @@ while (@f) {
}
}
}
DXDb::new($name, $remote, $chain);
DXDb::new($name, $remote, $chain, $cmd);
push @out, $self->msg($remote ? 'db7' : 'db8', $name, $remote);
return (1, @out);

View File

@ -42,6 +42,7 @@ $dbbase = "$main::root/db"; # where all the databases are kept;
tae => '9,End App txt',
atemplate => '9,App Templates,parray',
help => '0,Help txt,parray',
localcmd => '0,Local Command',
);
$lastprocesstime = time;
@ -157,7 +158,16 @@ sub getkey
# make sure we are open
$self->open;
if ($self->{db}) {
if ($self->{localcmd}) {
my $dxchan = $main::me;
$dxchan->{remotecmd} = 1; # for the benefit of any command that needs to know
my $oldpriv = $dxchan->{priv};
$dxchan->{priv} = 0;
my @in = (DXCommandmode::run_cmd($dxchan, "$self->{localcmd} $key"));
$dxchan->{priv} = $oldpriv;
delete $dxchan->{remotecmd};
return @in ? join("\n", @in) : undef;
} elsif ($self->{db}) {
my $s = $self->{db}->get($key, $value);
return $s ? undef : $value;
}
@ -187,10 +197,14 @@ sub new
my $name = shift;
my $remote = shift;
my $chain = shift;
my $cmd = shift;
$self->{name} = lc $name;
$self->{remote} = uc $remote if $remote;
$self->{chain} = $chain if $chain && ref $chain;
$self->{accesst} = $self->{createt} = $self->{lastt} = $main::systime;
$self->{localcmd} = lc $cmd if $cmd;
$avail{$self->{name}} = $self;
mkdir $dbbase, 02775 unless -e $dbbase;
save();