X-Git-Url: http://dxcluster.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FDXChannel.pm;h=580783a6a466383f2ae8fac35106c03d2f38e38f;hb=c4f04ae165fdc765f3baa26fa2b28b52cf967674;hp=c4a81c7f509b503a9c3025217f2a3f80b45c5177;hpb=f9fbccb42b30e28358cf59ee06e17a2d610561f6;p=spider.git diff --git a/perl/DXChannel.pm b/perl/DXChannel.pm index c4a81c7f..580783a6 100644 --- a/perl/DXChannel.pm +++ b/perl/DXChannel.pm @@ -105,6 +105,9 @@ $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', ); use vars qw($VERSION $BRANCH); @@ -505,8 +508,9 @@ 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; my @users = $nref->users; return 1 if @users == 0 || grep $user eq $_, @users; @@ -521,6 +525,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 {