sub present
{
my $call = uc shift;
- return DXCluster->get_exact($call);
+ return Route::get($call);
}
# is it remotely connected anywhere (ignoring SSIDS)?
sub presentish
{
my $call = uc shift;
- return DXCluster->get($call);
+ my $c = Route::get($call);
+ unless ($c) {
+ for (1..15) {
+ $c = Route::get("$call-$_");
+ last if $c;
+ }
+ }
+ return $c;
}
# is it remotely connected anywhere (with exact callsign) and on node?
sub present_on
{
my $call = uc shift;
- my $node = uc shift;
- my $ref = DXCluster->get_exact($call);
- return ($ref && $ref->mynode) ? $ref->mynode->call eq $node : undef;
+ my $ncall = uc shift;
+ my $node = Route::Node::get($ncall);
+ return ($node) ? grep $call eq $_, $node->users : undef;
}
-# is it remotely connected anywhere (ignoring SSIDS) and on node?
+# is it remotely connected (ignoring SSIDS) and on node?
sub presentish_on
{
my $call = uc shift;
- my $node = uc shift;
- my $ref = DXCluster->get($call);
- return ($ref && $ref->mynode) ? $ref->mynode->call eq $node : undef;
+ my $ncall = uc shift;
+ my $node = Route::Node::get($ncall);
+ my $present;
+ if ($node) {
+ $present = grep {/^$call/ } $node->users;
+ }
+ return $present;
}
# last time this thing was connected
# disconnect a locally connected thing
sub disconnect
{
- my $call = uc shift;
- my $dxchan = DXChannel->get($call);
- $dxchan->disconnect if $dxchan;
+ my $call = shift;
+ run_cmd("disconnect $call");
}
# start a connect process off
sub start_connect
{
- my $call = uc shift;
- my $lccall = lc $call;
-
- if (Msg->conns($call)) {
- dbg('cron', "Connect not started, outstanding connect to $call");
- return;
- }
- if (-e "$main::root/connect/$lccall") {
- ExtMsg::start_connect($call, "$main::root/connect/$lccall");
- } else {
- dbg('err', "Cannot find connect script for $lccall");
- }
+ my $call = shift;
+ # connecting is now done in one place - Yeah!
+ run_cmd("connect $call");
}
# spawn any old job off
for (@main::listeners) {
$_->close_server;
}
- unless ($^O =~ /^MS/) {
+ unless ($main::is_win) {
$SIG{HUP} = 'IGNORE';
$SIG{CHLD} = $SIG{TERM} = $SIG{INT} = $SIG{__WARN__} = 'DEFAULT';
alarm(0);
my $line = shift;
# can we see it? Is it a node?
- my $noderef = DXCluster->get_exact($call);
- return if !$noderef || !$noderef->pcversion;
+ my $noderef = Route::Node::get($call);
+ return unless $noderef && $noderef->version;
# send it
DXProt::addrcmd($DXProt::me, $call, $line);
}
+
+sub run_cmd
+{
+ my $line = shift;
+ my @in = DXCommandmode::run_cmd($DXProt::me, $line);
+ dbg('cron', "cmd run: $line");
+ for (@in) {
+ s/\s*$//og;
+ dbg('cron', "cmd out: $_");
+ }
+}
1;
__END__