return (1, $self->msg('e5')) if $self->priv < 5;
return (1, $self->msg('e6')) unless $call gt ' ';
-return (1, $self->msg('already', $call)) if DXChannel->get($call);
+return (1, $self->msg('already', $call)) if DXChannel::get($call);
return (1, $self->msg('outconn', $call)) if grep {$_->{call} eq $call} @main::outstanding_connects;
return (1, $self->msg('conscript', $lccall)) unless -e "$main::root/connect/$lccall";
if ($db->remote) {
# remote databases
- unless (Route::Node::get($db->remote) || DXChannel->get($db->remote)) {
+ unless (Route::Node::get($db->remote) || DXChannel::get($db->remote)) {
push @out, $self->msg('db4', uc $name, $db->remote);
last;
}
foreach $call (@args) {
$call = uc $call;
- my $chan = DXChannel->get($call);
+ my $chan = DXChannel::get($call);
if ($chan) {
push @out, $self->msg('nodee1', $call);
} else {
my ($call, $newline) = split /\s+/, $line, 2;
$call = uc $call;
-my $dxchan = DXChannel->get($call);
+my $dxchan = DXChannel::get($call);
my $mycall = $self->call;
return (1, $self->msg('e7', $call)) unless $dxchan;
foreach $call (@calls) {
$call = uc $call;
next if $call eq $main::mycall;
- my $dxchan = DXChannel->get($call);
+ my $dxchan = DXChannel::get($call);
if ($dxchan) {
if ($dxchan->is_node) {
# $dxchan->send_pc39($self->msg('disc1', $self->call));
push @out, $self->msg('disc3', $call);
# } elsif (my $ref = DXCluster->get_exact($call)) {
# my $dxchancall = $ref->dxchancall;
-# if ($dxchancall eq $main::mycall || !DXChannel->get($dxchancall)) {
+# if ($dxchancall eq $main::mycall || !DXChannel::get($dxchancall)) {
# $ref->del;
# push @out, $self->msg('disc4', $call);
# }
my $dxchan;
for ( map {uc $_ } split /\s+/, $line ) {
- if (($dxchan = DXChannel->get($_)) && $dxchan->is_node) {
+ if (($dxchan = DXChannel::get($_)) && $dxchan->is_node) {
push @dxchan, $dxchan;
} else {
push @out, $self->msg('e10', $_);
foreach $call (@calls) {
$call = uc $call;
next if $call eq $main::mycall;
- my $dxchan = DXChannel->get($call);
+ my $dxchan = DXChannel::get($call);
if ($dxchan) {
if ($dxchan->is_node) {
# first clear out any nodes on this dxchannel
push @out, " Ave Obs Ping Sec Since";
push @out, " Callsign Type Started RTT count Int. Last Ping";
-foreach $dxchan ( sort {$a->call cmp $b->call} DXChannel::get_all() ) {
+foreach $dxchan ( sort {$a->call cmp $b->call} grep {$_->is_node || $_->is_aranea} DXChannel::get_all() ) {
next if $dxchan->is_user;
my $call = $dxchan->call();
next if $dxchan == $main::me;
return (1, $self->msg('e5')) if $self->priv < 8 || $self->remotecmd || $self->inscript;
my $call = uc shift @f;
-my $dxchan = DXChannel->get($call);
+my $dxchan = DXChannel::get($call);
return (1, $self->msg('e10', $call)) if !$dxchan;
return (1, $self->msg('e8')) if @f <= 0;
foreach $call (@calls) {
$call = uc $call;
next if $call eq $main::mycall;
- my $dxchan = DXChannel->get($call);
+ my $dxchan = DXChannel::get($call);
if ($dxchan) {
if ($dxchan->is_node) {
my $parent = Route::Node::get($call);
foreach $call (@args) {
$call = uc $call;
- my $chan = DXChannel->get($call);
+ my $chan = DXChannel::get($call);
if ($chan) {
$chan->ann(1);
$chan->user->wantann(1);
foreach $call (@args) {
$call = uc $call;
- my $chan = DXChannel->get($call);
+ my $chan = DXChannel::get($call);
if ($chan) {
$chan->ann_talk(1);
$chan->user->wantann_talk(1);
foreach $call (@args) {
$call = uc $call;
- my $chan = DXChannel->get($call);
+ my $chan = DXChannel::get($call);
if ($chan) {
push @out, $self->msg('nodee1', $call);
} else {
foreach $call (@args) {
$call = uc $call;
- my $chan = DXChannel->get($call);
+ my $chan = DXChannel::get($call);
if ($chan) {
push @out, $self->msg('nodee1', $call);
} else {
foreach $call (@args) {
$call = uc $call;
- my $chan = DXChannel->get($call);
+ my $chan = DXChannel::get($call);
if ($chan) {
push @out, $self->msg('nodee1', $call);
} else {
foreach $call (@args) {
$call = uc $call;
- my $chan = DXChannel->get($call);
+ my $chan = DXChannel::get($call);
if ($chan) {
$chan->dx(1);
$chan->user->wantdx(1);
foreach $call (@args) {
$call = uc $call;
- my $chan = DXChannel->get($call);
+ my $chan = DXChannel::get($call);
if ($chan) {
push @out, $self->msg('nodee1', $call);
} else {
foreach $call (@args) {
$call = uc $call;
- my $dxchan = DXChannel->get($call);
+ my $dxchan = DXChannel::get($call);
if ($dxchan) {
$dxchan->here(1);
push @out, $self->msg('heres', $call);
foreach $call (@args) {
$call = uc $call;
- my $chan = DXChannel->get($call);
+ my $chan = DXChannel::get($call);
if ($chan) {
push @out, $self->msg('nodee1', $call);
} else {
foreach $call (@args) {
$call = uc $call;
- my $chan = DXChannel->get($call);
+ my $chan = DXChannel::get($call);
if ($chan) {
push @out, $self->msg('nodee1', $call);
} else {
foreach $call (@args) {
$call = uc $call;
- my $dxchan = DXChannel->get($call);
+ my $dxchan = DXChannel::get($call);
$user = $dxchan->user if $dxchan;
$user = DXUser->get_current($call);
if ($user) {
foreach $call (@args) {
$call = uc $call;
- my $dxchan = DXChannel->get($call);
+ my $dxchan = DXChannel::get($call);
$user = $dxchan->user if $dxchan;
$user = DXUser->get($call) unless $user;
if ($user) {
foreach $call (@args) {
$call = uc $call;
unless ($self->remotecmd || $self->inscript) {
- if ($ref = DXChannel->get($call)) {
+ if ($ref = DXChannel::get($call)) {
$ref->priv($priv);
$ref->user->priv($priv);
$ref->user->put();
$ref->put();
push @out, $self->msg("regc", $call);
}
- my $dxchan = DXChannel->get($call);
+ my $dxchan = DXChannel::get($call);
$dxchan->registered(1) if $dxchan;
Log('DXCommand', $self->call . " registered $call");
} else {
foreach $call (@args) {
$call = uc $call;
- my $chan = DXChannel->get($call);
+ my $chan = DXChannel::get($call);
if ($chan) {
push @out, $self->msg('nodee1', $call);
} else {
foreach $call (@args) {
$call = uc $call;
- my $chan = DXChannel->get($call);
+ my $chan = DXChannel::get($call);
if ($chan) {
$chan->talk(1);
$chan->user->wanttalk(1);
foreach $call (@args) {
$call = uc $call;
- my $chan = DXChannel->get($call);
+ my $chan = DXChannel::get($call);
if ($chan) {
DXChannel::wcy($chan, 1);
$chan->user->wantwcy(1);
foreach $call (@args) {
$call = uc $call;
- my $chan = DXChannel->get($call);
+ my $chan = DXChannel::get($call);
if ($chan) {
DXChannel::wwv($chan, 1);
$chan->user->wantwwv(1);
foreach $call (@args) {
$call = uc $call;
- my $chan = DXChannel->get($call);
+ my $chan = DXChannel::get($call);
if ($chan) {
$chan->wx(1);
$chan->user->wantwx(1);
push @out, $self->msg('showconf');
if ($list[0] && $list[0] =~ /^NOD/) {
- my @ch = sort {$a->call cmp $b->call} DXChannel::get_all_nodes();
+ my @ch = sort {$a->call cmp $b->call} grep {$_->is_node || $_->is_aranea} DXChannel::get_all();
my $dxchan;
foreach $dxchan (@ch) {
my $mylang = $self->lang;
my ($call, $newline) = split /\s+/, $line, 2;
-return (1, $self->msg('nodee1', $call)) if DXChannel->get($call);
+return (1, $self->msg('nodee1', $call)) if DXChannel::get($call);
if ($self->remotecmd || $self->inscript) {
Log('DXCommand', "$mycall is trying to spoof $call remotely");
my @out;
foreach $call (@list) {
$call = uc $call;
- my $ref = DXChannel->get($call);
+ my $ref = DXChannel::get($call);
if ($ref) {
@out = print_all_fields($self, $ref, "Channel Information $call");
} else {
foreach $call (@args) {
$call = uc $call;
- my $chan = DXChannel->get($call);
+ my $chan = DXChannel::get($call);
if ($chan) {
$chan->ann(0);
$chan->user->wantann(0);
foreach $call (@args) {
$call = uc $call;
- my $chan = DXChannel->get($call);
+ my $chan = DXChannel::get($call);
if ($chan) {
$chan->ann_talk(0);
$chan->user->wantann_talk(0);
foreach $call (@args) {
$call = uc $call;
- my $chan = DXChannel->get($call);
+ my $chan = DXChannel::get($call);
if ($chan) {
$chan->dx(0);
$chan->user->wantdx(0);
foreach $call (@args) {
$call = uc $call;
- my $dxchan = DXChannel->get($call);
+ my $dxchan = DXChannel::get($call);
if ($dxchan) {
$dxchan->here(0);
push @out, $self->msg('hereu', $call);
foreach $call (@args) {
$call = uc $call;
- my $chan = DXChannel->get($call);
+ my $chan = DXChannel::get($call);
if ($chan) {
push @out, $self->msg('nodee1', $call);
} else {
foreach $call (@args) {
$call = uc $call;
- my $chan = DXChannel->get($call);
+ my $chan = DXChannel::get($call);
if ($chan) {
push @out, $self->msg('nodee1', $call);
} else {
if ($ref = DXUser->get_current($call)) {
$ref->registered(0);
$ref->put();
- my $dxchan = DXChannel->get($call);
+ my $dxchan = DXChannel::get($call);
$dxchan->registered(0) if $dxchan;
push @out, $self->msg("regun", $call);
Log('DXCommand', $self->call . " unregistered $call");
foreach $call (@args) {
$call = uc $call;
- my $chan = DXChannel->get($call);
+ my $chan = DXChannel::get($call);
if ($chan) {
$chan->talk(0);
$chan->user->wanttalk(0);
foreach $call (@args) {
$call = uc $call;
- my $chan = DXChannel->get($call);
+ my $chan = DXChannel::get($call);
if ($chan) {
DXChannel::wcy($chan, 0);
$chan->user->wantwcy(0);
foreach $call (@args) {
$call = uc $call;
- my $chan = DXChannel->get($call);
+ my $chan = DXChannel::get($call);
if ($chan) {
DXChannel::wwv($chan, 0);
$chan->user->wantwwv(0);
foreach $call (@args) {
$call = uc $call;
- my $chan = DXChannel->get($call);
+ my $chan = DXChannel::get($call);
if ($chan) {
$chan->wx(0);
$chan->user->wantwx(0);
# set up the basic channel info
# is there one already connected to me - locally?
my $user = DXUser->get_current($call);
- my $dxchan = DXChannel->get($call);
+ my $dxchan = DXChannel::get($call);
if ($dxchan) {
if ($main::bumpexisting && $call ne $main::mycall) {
my $ip = $conn->{peerhost} || 'unknown';
}
}
-# obtain a channel object by callsign [$obj = DXChannel->get($call)]
+# obtain a channel object by callsign [$obj = DXChannel::get($call)]
sub get
{
- my ($pkg, $call) = @_;
- return $channels{$call};
+ return $channels{$_[0]};
}
# obtain all the channel objects
sub process
{
my $t = time;
- my @dxchan = DXChannel->get_all();
+ my @dxchan = DXChannel::get_all();
my $dxchan;
foreach $dxchan (@dxchan) {
my $pkg = shift; # ignored
my $s = shift; # the line to be rebroadcast
- foreach my $dxchan (DXChannel->get_all()) {
+ foreach my $dxchan (DXChannel::get_all()) {
next unless $dxchan->{sort} eq 'U'; # only interested in user channels
next if grep $dxchan == $_, @_;
$dxchan->send($s); # send it
# gimme all the users
sub get_all
{
- return grep {$_->{sort} eq 'U'} DXChannel->get_all();
+ return grep {$_->{sort} eq 'U'} DXChannel::get_all();
}
# run a script for this user
{
my $s = shift; # the line to be rebroadcast
- foreach my $dxchan (DXChannel->get_all) {
+ foreach my $dxchan (DXChannel::get_all) {
next unless $dxchan->{enhanced} && $dxchan->{senddbg};
$dxchan->send_later('L', $s);
}
sub connected
{
my $call = uc shift;
- return DXChannel->get($call);
+ return DXChannel::get($call);
}
# is it remotely connected anywhere (with exact callsign)?
sub last_connect
{
my $call = uc shift;
- return $main::systime if DXChannel->get($call);
+ return $main::systime if DXChannel::get($call);
my $user = DXUser->get($call);
return $user ? $user->lastin : 0;
}
# incoming DB Information
my $n = getstream($_[3]);
if ($n) {
- my $mchan = DXChannel->get($n->{call});
+ my $mchan = DXChannel::get($n->{call});
$mchan->send($_[2] . ":$_[4]") if $mchan;
}
}
my $ref = shift;
my $to = $ref->{to};
my $uref = DXUser->get_current($to);
- my $dxchan = DXChannel->get($to);
+ my $dxchan = DXChannel::get($to);
if (((*Net::SMTP && $email_server) || $email_prog) && $uref && $uref->wantemail) {
my $email = $uref->email;
if ($email) {
# RouteDB::update($to, $_[6]);
# it is here and logged on
- $dxchan = DXChannel->get($main::myalias) if $to eq $main::mycall;
- $dxchan = DXChannel->get($to) unless $dxchan;
+ $dxchan = DXChannel::get($main::myalias) if $to eq $main::mycall;
+ $dxchan = DXChannel::get($to) unless $dxchan;
if ($dxchan && $dxchan->is_user) {
$_[3] =~ s/\%5E/^/g;
$dxchan->talk($from, $to, $via, $_[3]);
my $dxchan;
- if ((($dxchan = DXChannel->get($_[2])) && $dxchan->is_user) || $_[4] =~ /^[\#\w.]+$/){
+ if ((($dxchan = DXChannel::get($_[2])) && $dxchan->is_user) || $_[4] =~ /^[\#\w.]+$/){
$self->send_chat($line, @_[1..6]);
} elsif ($_[2] eq '*' || $_[2] eq $main::mycall) {
}
}
$user->wantroutepc19(1) unless defined $wantpc19; # for now we work on the basis that pc16 = real route
- $user->lastin($main::systime) unless DXChannel->get($ncall);
+ $user->lastin($main::systime) unless DXChannel::get($ncall);
$user->put;
# route the pc19 - this will cause 'stuttering PC19s' for a while
$user = DXUser->new($call) if !$user;
$user->homenode($parent->call) if !$user->homenode;
$user->node($parent->call);
- $user->lastin($main::systime) unless DXChannel->get($call);
+ $user->lastin($main::systime) unless DXChannel::get($call);
$user->put;
}
$self->route_pc16($origin, $line, $parent, @rout) if @rout;
next if $call eq $main::mycall;
# check that this PC19 isn't trying to alter the wrong dxchan
- my $dxchan = DXChannel->get($call);
+ my $dxchan = DXChannel::get($call);
if ($dxchan && $dxchan != $self) {
dbg("PCPROT: PC19 from $origin trying to alter wrong locally connected $call, ignored!") if isdbg('chanerr');
next;
my $mref = DXMsg::get_busy($call);
$mref->stop_msg($call) if $mref;
- $user->lastin($main::systime) unless DXChannel->get($call);
+ $user->lastin($main::systime) unless DXChannel::get($call);
$user->put;
}
my $node = Route::Node::get($call);
if ($node) {
- my $dxchan = DXChannel->get($call);
+ my $dxchan = DXChannel::get($call);
if ($dxchan && $dxchan != $self) {
dbg("PCPROT: PC21 from $origin trying to alter locally connected $call, ignored!") if isdbg('chanerr');
return;
# it's a reply, look in the ping list for this one
my $ref = $pings{$from};
if ($ref) {
- my $tochan = DXChannel->get($from);
+ my $tochan = DXChannel::get($from);
while (@$ref) {
my $r = shift @$ref;
- my $dxchan = DXChannel->get($r->{call});
+ my $dxchan = DXChannel::get($r->{call});
next unless $dxchan;
my $t = tv_interval($r->{t}, [ gettimeofday ]);
if ($dxchan->is_user) {
sub process
{
my $t = time;
- my @dxchan = DXChannel->get_all();
+ my @dxchan = DXChannel::get_all();
my $dxchan;
my $pc50s;
{
my $self = shift;
my $line = shift;
- my @dxchan = DXChannel->get_all();
+ my @dxchan = DXChannel::get_all();
my $dxchan;
my @dxcc = ((Prefix::cty_data($_[6]))[0..2], (Prefix::cty_data($_[7]))[0..2]);
{
my $self = shift;
my $line = shift;
- my @dxchan = DXChannel->get_all();
+ my @dxchan = DXChannel::get_all();
my $dxchan;
my @dxcc = ((Prefix::cty_data($_[10]))[0..2], (Prefix::cty_data($_[11]))[0..2]);
{
my $self = shift;
my $line = shift;
- my @dxchan = DXChannel->get_all();
+ my @dxchan = DXChannel::get_all();
my $dxchan;
my $target;
my $to = 'To ';
{
my $self = shift;
my $line = shift;
- my @dxchan = DXChannel->get_all();
+ my @dxchan = DXChannel::get_all();
my $dxchan;
my $target = $_[3];
my $text = unpad($_[2]);
# don't appear outside of this node
# send locally connected nodes
- my @dxchan = grep { $_->call ne $main::mycall && $_ != $self && !$_->{isolate} } DXChannel::get_all_nodes();
+ my @dxchan = grep { $_->call ne $main::mycall && $_ != $self && !$_->{isolate} && ($_->is_node || $_->is_aranea) } DXChannel::get_all();
@localnodes = map { my $r = Route::Node::get($_->{call}); $r ? $r : () } @dxchan if @dxchan;
$self->send_route($main::mycall, \&pc19, scalar(@localnodes)+1, $main::routeroot, @localnodes);
}
# always send it down the local interface if available
- my $dxchan = DXChannel->get($call);
+ my $dxchan = DXChannel::get($call);
if ($dxchan) {
dbg("route: $call -> $dxchan->{call} direct" ) if isdbg('route');
} else {
dbg("PCPROT: Trying to route back to source, dropped") if isdbg('chanerr');
return;
}
- $dxchan = DXChannel->get($rcall);
+ $dxchan = DXChannel::get($rcall);
dbg("route: $call -> $rcall using RouteDB" ) if isdbg('route') && $dxchan;
}
}
my $r = {};
$r->{call} = $from;
$r->{t} = [ gettimeofday ];
- if ($via && (my $dxchan = DXChannel->get($via))) {
+ if ($via && (my $dxchan = DXChannel::get($via))) {
$dxchan->send(pc51($to, $main::mycall, 1));
} else {
route(undef, $to, pc51($to, $main::mycall, 1));
if ($tonode eq $main::mycall) {
my $s = $rcmds{$fromnode};
if ($s) {
- my $dxchan = DXChannel->get($s->{call});
- my $ref = $user eq $tonode ? $dxchan : (DXChannel->get($user) || $dxchan);
+ my $dxchan = DXChannel::get($s->{call});
+ my $ref = $user eq $tonode ? $dxchan : (DXChannel::get($user) || $dxchan);
$ref->send($line) if $ref;
delete $rcmds{$fromnode} if !$dxchan;
} else {
# send unsolicited ones to the sysop
- my $dxchan = DXChannel->get($main::myalias);
+ my $dxchan = DXChannel::get($main::myalias);
$dxchan->send($line) if $dxchan;
}
} else {
my $pkg = shift;
my $call = uc shift;
- my $dxchan = DXChannel->get($call);
+ my $dxchan = DXChannel::get($call);
return $dxchan->user if $dxchan;
my $rref = Route::get($call);
return $rref->user if $rref && exists $rref->{user};
use strict;
use vars qw($VERSION $BRANCH);
-$VERSION = sprintf( "%d.%03d", q$Revision$ =~ /(\d+)\.(\d+)/ );
-$BRANCH = sprintf( "%d.%03d", q$Revision$ =~ /^\d+\.\d+(?:\.(\d+)\.(\d+))?$/ || (0,0));
-$main::build += $VERSION;
-$main::branch += $BRANCH;
+
+main::mkver($VERSION = q$Revision$);
use vars qw ($filterbasefn $in);
my $dxchan;
my @dxchan;
if ($name eq 'NODE_DEFAULT') {
- @dxchan = DXChannel::get_all_nodes();
+ @dxchan = grep{$_->is_node || $_->is_aranea} DXChannel::get_all();
} elsif ($name eq 'USER_DEFAULT') {
@dxchan = DXChannel::get_all_users();
} else {
- $dxchan = DXChannel->get($name);
+ $dxchan = DXChannel::get($name);
push @dxchan, $dxchan if $dxchan;
}
foreach $dxchan (@dxchan) {
$user->set_believe($self->{call});
$user->put;
}
- my $dxchan = DXChannel->get($self->{via});
+ my $dxchan = DXChannel::get($self->{via});
if ($dxchan) {
dbg("Investigate: sending PC19 for $self->{call}") if isdbg('investigate');
foreach my $pc (@{$self->{pcxx}}) {
$call = ' ' x length $call;
# recursion detector
- if ((DXChannel->get($self->{call}) && $level > 1) || grep $self->{call} eq $_, @$seen) {
+ if ((DXChannel::get($self->{call}) && $level > 1) || grep $self->{call} eq $_, @$seen) {
$line .= ' ...';
push @out, $line;
return @out;
my @dxchan;
# dbg("Trying node $self->{call}") if isdbg('routech');
- my $dxchan = DXChannel->get($self->{call});
+ my $dxchan = DXChannel::get($self->{call});
push @dxchan, $dxchan if $dxchan;
# it isn't, build up a list of dxchannels and possible ping times
foreach my $p (@{$self->{parent}}) {
# dbg("Trying parent $p") if isdbg('routech');
next if $p eq $main::mycall; # the root
- my $dxchan = DXChannel->get($p);
+ my $dxchan = DXChannel::get($p);
if ($dxchan) {
push @dxchan, $dxchan unless grep $dxchan == $_, @dxchan;
} else {
my $self = shift;
# ALWAYS return the locally connected channel if present;
- my $dxchan = DXChannel->get($self->call);
+ my $dxchan = DXChannel::get($self->call);
return $dxchan if $dxchan;
my @dxchan = $self->alldxchan;
}
while (@queue) {
$thing = shift @queue;
- my $dxchan = DXChannel->get($thing->{dxchan});
+ my $dxchan = DXChannel::get($thing->{dxchan});
if ($dxchan) {
if ($thing->can('in_filter')) {
next unless $thing->in_filter($dxchan);
$user = DXUser->new($call) if !$user;
$user->homenode($parentcall) if !$user->homenode;
$user->node($parentcall);
- $user->lastin($main::systime) unless DXChannel->get($call);
+ $user->lastin($main::systime) unless DXChannel::get($call);
return $user;
}
# set up the basic channel info
# is there one already connected to me - locally?
my $user = DXUser->get_current($call);
- my $dxchan = DXChannel->get($call);
+ my $dxchan = DXChannel::get($call);
if ($dxchan) {
if ($user && $user->is_node) {
already_conn($conn, $call, DXM::msg($lang, 'concluster', $call, $main::mycall));
dbg("Local::finish error $@") if $@;
# disconnect nodes
- foreach $dxchan (DXChannel->get_all_nodes) {
+ foreach $dxchan (grep {$_->is_node || $_->is_aranea} DXChannel::get_all()) {
$dxchan->disconnect(2) unless $dxchan == $main::me;
}
Msg->event_loop(100, 0.01);
# disconnect users
- foreach $dxchan (DXChannel->get_all_users) {
+ foreach $dxchan (DXChannel::get_all_users) {
$dxchan->disconnect;
}