WIP RBN
[spider.git] / perl / DXChannel.pm
index 91900e4b3c8a360118e25075993ba8387cd20a18..73102ff461503f1cc904b60f03cb3045d4a5eac0 100644 (file)
@@ -62,6 +62,9 @@ $count = 0;
                  here => '0,Here?,yesno',
                  conf => '0,In Conference?,yesno',
                  dx => '0,DX Spots,yesno',
+                 rbn => '0,RBN Spots,yesno',
+                 ft => '0,(RBN) FT4/8 Spots,yesno',
+                 cw => '0,RBN CW Spots,yesno',
                  redirect => '0,Redirect messages to',
                  lang => '0,Language',
                  func => '5,Function',
@@ -125,6 +128,7 @@ $count = 0;
                  inqueue => '9,Input Queue,parray',
                  next_pc92_update => '9,Next PC92 Update,atime',
                  next_pc92_keepalive => '9,Next PC92 KeepAlive,atime',
+                 hostname => '0,Hostname',
                 );
 
 $maxerrors = 20;                               # the maximum number of concurrent errors allowed before disconnection
@@ -160,7 +164,7 @@ sub alloc
                $self->{group} = $user->group;
                $self->{sort} = $user->sort;
        }
-       $self->{startt} = $self->{t} = time;
+       $self->{startt} = $self->{t} = $main::systime;
        $self->{state} = 0;
        $self->{oldstate} = 0;
        $self->{lang} = $main::lang if !$self->{lang};
@@ -299,69 +303,65 @@ sub del
 # is it a bbs
 sub is_bbs
 {
-       my $self = shift;
-       return $self->{'sort'} eq 'B';
+       return $_[0]->{sort} eq 'B';
 }
 
 sub is_node
 {
-       my $self = shift;
-       return $self->{'sort'} =~ /[ACRSXW]/;
+       return $_[0]->{sort} =~ /^[ACRSX]$/;
 }
 # is it an ak1a node ?
 sub is_ak1a
 {
-       my $self = shift;
-       return $self->{'sort'} eq 'A';
+       return $_[0]->{sort} eq 'A';
 }
 
 # is it a user?
 sub is_user
 {
-       my $self = shift;
-       return $self->{'sort'} eq 'U';
+       return $_[0]->{sort} =~ /^[UW]$/;
 }
 
 # is it a clx node
 sub is_clx
 {
-       my $self = shift;
-       return $self->{'sort'} eq 'C';
+       return $_[0]->{sort} eq 'C';
 }
 
-# it is Aranea
-sub is_aranea
+# it is a Web connected user
+sub is_web
 {
-       my $self = shift;
-       return $self->{'sort'} eq 'W';
+       return $_[0]->{sort} eq 'W';
 }
 
 # is it a spider node
 sub is_spider
 {
-       my $self = shift;
-       return $self->{'sort'} eq 'S';
+       return $_[0]->{sort} eq 'S';
 }
 
 # is it a DXNet node
 sub is_dxnet
 {
-       my $self = shift;
-       return $self->{'sort'} eq 'X';
+       return $_[0]->{sort} eq 'X';
 }
 
 # is it a ar-cluster node
 sub is_arcluster
 {
-       my $self = shift;
-       return $self->{'sort'} eq 'R';
+       return $_[0]->{sort} eq 'R';
+}
+
+sub is_rbn
+{
+       return $_[0]->{sort} eq 'N';
 }
 
 # for perl 5.004's benefit
 sub sort
 {
        my $self = shift;
-       return @_ ? $self->{'sort'} = shift : $self->{'sort'} ;
+       return @_ ? $self->{sort} = shift : $self->{sort} ;
 }
 
 # find out whether we are prepared to believe this callsign on this interface
@@ -500,7 +500,7 @@ sub disconnect
        my $self = shift;
        my $user = $self->{user};
        
-       $user->close() if defined $user;
+       $user->close($self->{startt}, $self->{hostname}) if defined $user;
        $self->{conn}->disconnect if $self->{conn};
        $self->del();
 }
@@ -587,7 +587,7 @@ sub decode_input
 {
        my $dxchan = shift;
        my $data = shift;
-       my ($sort, $call, $line) = $data =~ /^([A-Z])([A-Z0-9\/\-]{3,25})\|(.*)$/;
+       my ($sort, $call, $line) = $data =~ /^([A-Z])(#?[A-Z0-9\/\-]{3,25})\|(.*)$/;
 
        my $chcall = (ref $dxchan) ? $dxchan->call : "UN.KNOWN";
        
@@ -682,6 +682,11 @@ sub broadcast_list
                        ($filter) = $dxchan->{spotsfilter}->it(@{$fref}) if ref $fref;
                        next unless $filter;
                }
+               if ($sort eq 'rbn') {
+                   next unless $dxchan->{dx}; # this is deliberate!
+                       ($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};
@@ -717,7 +722,7 @@ sub process_one
                        $self->normal($line);
                } elsif ($sort eq 'G') {
                        $self->enhanced($line);
-               } elsif ($sort eq 'A' || $sort eq 'O') {
+               } elsif ($sort eq 'A' || $sort eq 'O' || $sort eq 'W') {
                        $self->start($line, $sort);
                } elsif ($sort eq 'Z') {
                        $self->disconnect;