X-Git-Url: http://dxcluster.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FDXChannel.pm;h=584015518e6ea2b93478b10660d80d7e60ac4da3;hb=579810d363939640538f88a9caa86e01fe9c7709;hp=61e6a5d3e9dd31dd2ac094d7e34ce168c8248256;hpb=c87553a14286b31db30d28decb1c0d5c8327e443;p=spider.git diff --git a/perl/DXChannel.pm b/perl/DXChannel.pm index 61e6a5d3..58401551 100644 --- a/perl/DXChannel.pm +++ b/perl/DXChannel.pm @@ -85,7 +85,7 @@ $count = 0; inwcyfilter => '5,WCY Filt-inp', inspotsfilter => '5,Spot Filt-inp', inroutefilter => '5,Route Filt-inp', - passwd => '9,Passwd List,parray', + passwd => '9,Passwd List,yesno', pingint => '5,Ping Interval ', nopings => '5,Ping Obs Count', lastping => '5,Ping last sent,atime', @@ -105,6 +105,10 @@ $count = 0; width => '0,Column Width', disconnecting => '9,Disconnecting,yesno', ann_talk => '0,Suppress Talk Anns,yesno', + metric => '1,Route metric', + badcount => '1,Bad Word Count', + edit => '7,Edit Function', + registered => '9,Registered?,yesno', ); use vars qw($VERSION $BRANCH); @@ -505,10 +509,12 @@ sub rspfcheck { my ($self, $flag, $node, $user) = @_; my $nref = Route::Node::get($node); - if ($nref) { - if ($nref->dxchan == $self) { + my $dxchan = $nref->dxchan if $nref; + if ($nref && $dxchan) { + if ($dxchan == $self) { return 1 unless $user; - return 1 if grep $user eq $_, $nref->users; + my @users = $nref->users; + return 1 if @users == 0 || grep $user eq $_, @users; dbg("RSPF: $user not on $node") if isdbg('rspf'); } else { dbg("RSPF: Shortest path for $node is " . $nref->dxchan->{call}) if isdbg('rspf'); @@ -520,6 +526,98 @@ sub rspfcheck return 0; } +# broadcast a message to all clusters taking into account isolation +# [except those mentioned after buffer] +sub broadcast_nodes +{ + my $s = shift; # the line to be rebroadcast + my @except = @_; # to all channels EXCEPT these (dxchannel refs) + my @dxchan = DXChannel::get_all_nodes(); + my $dxchan; + + # send it if it isn't the except list and isn't isolated and still has a hop count + foreach $dxchan (@dxchan) { + next if grep $dxchan == $_, @except; + next if $dxchan == $main::me; + + my $routeit = $dxchan->can('adjust_hops') ? $dxchan->adjust_hops($s) : $s; # adjust its hop count by node name + + $dxchan->send($routeit) unless $dxchan->{isolate} || !$routeit; + } +} + +# broadcast a message to all clusters ignoring isolation +# [except those mentioned after buffer] +sub broadcast_all_nodes +{ + my $s = shift; # the line to be rebroadcast + my @except = @_; # to all channels EXCEPT these (dxchannel refs) + my @dxchan = DXChannel::get_all_nodes(); + my $dxchan; + + # send it if it isn't the except list and isn't isolated and still has a hop count + foreach $dxchan (@dxchan) { + next if grep $dxchan == $_, @except; + next if $dxchan == $main::me; + + my $routeit = $dxchan->can('adjust_hops') ? $dxchan->adjust_hops($s) : $s; # adjust its hop count by node name + $dxchan->send($routeit); + } +} + +# broadcast to all users +# storing the spot or whatever until it is in a state to receive it +sub broadcast_users +{ + my $s = shift; # the line to be rebroadcast + my $sort = shift; # the type of transmission + my $fref = shift; # a reference to an object to filter on + my @except = @_; # to all channels EXCEPT these (dxchannel refs) + my @dxchan = DXChannel::get_all_users(); + my $dxchan; + my @out; + + foreach $dxchan (@dxchan) { + next if grep $dxchan == $_, @except; + push @out, $dxchan; + } + broadcast_list($s, $sort, $fref, @out); +} + + +# broadcast to a list of users +sub broadcast_list +{ + my $s = shift; + my $sort = shift; + my $fref = shift; + my $dxchan; + + foreach $dxchan (@_) { + my $filter = 1; + next if $dxchan == $main::me; + + if ($sort eq 'dx') { + next unless $dxchan->{dx}; + ($filter) = $dxchan->{spotsfilter}->it(@{$fref}) if ref $fref; + next unless $filter; + } + next if $sort eq 'ann' && !$dxchan->{ann} && $s !~ /^To\s+LOCAL\s+de\s+(?:$main::myalias|$main::mycall)/i; + next if $sort eq 'wwv' && !$dxchan->{wwv}; + next if $sort eq 'wcy' && !$dxchan->{wcy}; + next if $sort eq 'wx' && !$dxchan->{wx}; + + $s =~ s/\a//og unless $dxchan->{beep}; + + if ($dxchan->{state} eq 'prompt' || $dxchan->{state} eq 'talk') { + $dxchan->send($s); + } else { + $dxchan->delay($s); + } + } +} + + no strict; sub AUTOLOAD {