+29Jul00=======================================================================
+1. added forward/latlong which will forward ALL the users that have a latitude
+and longitude set on them to one or more locally connected nodes - with a hop
+count of 1.
28Jul00=======================================================================
1. fixed watchdbg midnight rollover loop and removed the date part of the
date/time translation to leave just the time.
--- /dev/null
+#
+# merge_qra <node>
+#
+# send out PC41s toward a node for every user that has a lat/long
+#
+# Copyright (c) 2000 Dirk Koopman G1TLH
+#
+# $Id$
+#
+
+my ($self, $line) = @_;
+return (1, $self->msg('e5')) unless $self->priv >= 6;
+
+my @dxchan;
+my @out;
+my $dxchan;
+
+for ( map {uc $_ } split /\s+/, $line ) {
+ if (($dxchan = DXChannel->get($_)) && $dxchan->is_node) {
+ push @dxchan, $dxchan;
+ } else {
+ push @out, $self->msg('e10', $_);
+ }
+}
+return (1, @out) if @out;
+
+use DB_File;
+
+my ($action, $count, $key, $data);
+for ($action = R_FIRST, $count = 0; !$DXUser::dbm->seq($key, $data, $action); $action = R_NEXT) {
+ if ($data =~ m{(?:lat|long) =>}) {
+ my $u = DXUser->get_current($key);
+ if ($u) {
+ my $lat = $u->lat;
+ my $long = $u->long;
+ my $latlong = DXBearing::lltos($lat, $long) if $lat && $long;
+ if ($latlong) {
+ #push @out, $key;
+ for (@dxchan) {
+ my $s = DXProt::pc41($key, 3, $latlong);
+ $s =~ s{H\d+\^~$}{H1^~};
+ $dxchan->send($s);
+ }
+ ++$count;
+ }
+ }
+ }
+}
+return(1, @out, "$count records sent");
# search thru the user for nodes
unless (@call) {
- @call = sort map { my $ref; (($ref = DXUser->get_current($_)) && $ref->sort ne 'U') ? $_ : () } DXUser::get_all_calls;
+# the official way
+# @call = sort map { my $ref; (($ref = DXUser->get_current($_)) && $ref->sort ne 'U') ? $_ : () } DXUser::get_all_calls;
+ use DB_File;
+
+ my ($action, $count, $key, $data);
+ for ($action = R_FIRST, $count = 0; !$DXUser::dbm->seq($key, $data, $action); $action = R_NEXT) {
+ if ($data =~ m{sort => '[ACRSX]'}) {
+ push @call, $key;
+ }
+ ++$count;
+ }
}
my $call;
my $pcall = sprintf "%-11s", $call;
push @out, $self->msg('snode1') unless @out > 0;
if ($uref) {
+ $sort = "Unknwn";
$sort = "Spider" if $uref->is_spider;
$sort = "AK1A " if $uref->is_ak1a;
$sort = "Clx " if $uref->is_clx;
}
my ($major, $minor, $subs) = unpack("AAA*", $ver) if $ver;
- if ($sort eq 'Spider') {
+ if ($uref->is_spider) {
push @out, $self->msg('snode2', $pcall, $sort, "$ver ");
} else {
push @out, $self->msg('snode2', $pcall, $sort, $ver ? "$major\-$minor.$subs" : " ");
{
my $pkg = shift;
my $call = uc shift;
- # $call =~ s/-\d+$//o; # strip ssid
- my $s = $u{$call};
- return $s ? decode($s) : undef;
-}
-
-#
-# get all callsigns in the database
-#
-
-sub get_all_calls
-{
- return (sort keys %u);
+ my $data;
+ unless ($dbm->get($call, $data)) {
+ return decode($data);
+ }
+ return undef;
}
#
{
my $pkg = shift;
my $call = uc shift;
- # $call =~ s/-\d+$//o; # strip ssid
my $dxchan = DXChannel->get($call);
return $dxchan->user if $dxchan;
- return get($pkg, $call);
+ my $data;
+ unless ($dbm->get($call, $data)) {
+ return decode($data);
+ }
+ return undef;
+}
+
+#
+# get all callsigns in the database
+#
+
+sub get_all_calls
+{
+ return (sort keys %u);
}
#
}
delete $self->{annok} if $self->{annok};
delete $self->{dxok} if $self->{dxok};
- $u{$call} = $self->encode();
+ $dbm->put($call, $self->encode);
}
#
{
my $s = shift;
my $ref;
- $s = '$ref = ' . $s;
- eval $s;
- Log('DXUser', $@) if $@;
- $ref = undef if $@;
+ eval '$ref = ' . $s;
+ if ($@) {
+ dbg('err', $@) if $@;
+ Log('err', $@) if $@;
+ $ref = undef;
+ }
return $ref;
}