From: minima Date: Sun, 10 Jun 2001 11:00:49 +0000 (+0000) Subject: fix set/here and unset/here X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=commitdiff_plain;h=125670de1ca386c044416d59935cfad9e1759c06;p=spider.git fix set/here and unset/here --- diff --git a/Changes b/Changes index 9a0901b5..9b102bba 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,5 @@ +10Jun01======================================================================= +1. fix set/here and unset/here 09Jun01======================================================================= 1. more fixes 2. add set/debug filter so that you can see why your filters aren't working diff --git a/cmd/set/here.pl b/cmd/set/here.pl index 8d5665c9..44fc4d4b 100644 --- a/cmd/set/here.pl +++ b/cmd/set/here.pl @@ -16,23 +16,16 @@ my @out; foreach $call (@args) { $call = uc $call; my $dxchan = DXChannel->get($call); - my $ref = Route::User::get($call); if ($dxchan) { $dxchan->here(1); push @out, $self->msg('heres', $call); + my $ref = Route::User::get($call); + $ref = Route::Node::get($call) unless $ref; if ($ref) { - my $s = DXProt::pc24($ref); - DXProt::eph_dup($s); - DXProt::broadcast_all_ak1a($s, $DXProt::me) ; $ref->here(1); - } elsif ($ref = Route::Node::get($call)) { my $s = DXProt::pc24($ref); DXProt::eph_dup($s); DXProt::broadcast_all_ak1a($s, $DXProt::me) ; - $ref->here(1); - } else { - $ref = Route::Node::get($call); - $ref->here(1) if $ref; } } else { push @out, $self->msg('e3', "Set Here", $call); diff --git a/cmd/unset/here.pl b/cmd/unset/here.pl index c1c7b0f7..4da517c1 100644 --- a/cmd/unset/here.pl +++ b/cmd/unset/here.pl @@ -16,23 +16,16 @@ my @out; foreach $call (@args) { $call = uc $call; my $dxchan = DXChannel->get($call); - my $ref = Route::User::get($call); if ($dxchan) { $dxchan->here(0); push @out, $self->msg('hereu', $call); + my $ref = Route::User::get($call); + $ref = Route::Node::get($call) unless $ref; if ($ref) { - my $s = DXProt::pc24($ref); - DXProt::eph_dup($s); - DXProt::broadcast_all_ak1a($s, $DXProt::me) ; $ref->here(0); - } elsif ($ref = Route::Node::get($call)) { my $s = DXProt::pc24($ref); DXProt::eph_dup($s); DXProt::broadcast_all_ak1a($s, $DXProt::me) ; - $ref->here(0); - } else { - $ref = Route::Node::get($call); - $ref->here(0) if $ref; } } else { push @out, $self->msg('e3', "Unset Here", $call); diff --git a/perl/Route.pm b/perl/Route.pm index b4306e04..521068b0 100644 --- a/perl/Route.pm +++ b/perl/Route.pm @@ -112,14 +112,20 @@ sub _dellist # # flag field constructors/enquirers # +# These can be called in various ways:- +# +# Route::here or $ref->here returns 1 or 0 depending on value of the here flag +# Route::here(1) returns 2 (the bit value of the here flag) +# $ref->here(1) or $ref->here(0) sets the here flag +# sub here { my $self = shift; my $r = shift; return $self ? 2 : 0 unless ref $self; - return ($self->{flags} & 2) ? 1 : 0 unless $r; - $self->{flags} = (($self->{flags} & ~2) | ($r ? 1 : 0)); + return ($self->{flags} & 2) ? 1 : 0 unless defined $r; + $self->{flags} = (($self->{flags} & ~2) | ($r ? 2 : 0)); return $r ? 1 : 0; } @@ -128,7 +134,7 @@ sub conf my $self = shift; my $r = shift; return $self ? 1 : 0 unless ref $self; - return ($self->{flags} & 1) ? 1 : 0 unless $r; + return ($self->{flags} & 1) ? 1 : 0 unless defined $r; $self->{flags} = (($self->{flags} & ~1) | ($r ? 1 : 0)); return $r ? 1 : 0; }