more mrtg, store in 10ths and display to 0.1 sec
[spider.git] / perl / DXChannel.pm
index 895a47b14d655ff7c6f3dd66d93d02ea757104d2..91900e4b3c8a360118e25075993ba8387cd20a18 100644 (file)
@@ -19,7 +19,7 @@
 # firstly and OO about ninthly (if you don't like the design and you can't 
 # improve it with better OO and thus make it smaller and more efficient, then tough). 
 #
-# Copyright (c) 1998-2000 - Dirk Koopman G1TLH
+# Copyright (c) 1998-2016 - Dirk Koopman G1TLH
 #
 #
 #
@@ -171,7 +171,7 @@ sub alloc
        if (@dxcc > 0) {
                $self->{dxcc} = $dxcc[1]->dxcc;
                $self->{itu} = $dxcc[1]->itu;
-               $self->{cq} = $dxcc[1]->cq;                                             
+               $self->{cq} = $dxcc[1]->cq;
        }
        $self->{inqueue} = [];
 
@@ -213,6 +213,7 @@ sub rec
        if (defined $msg) {
                push @{$self->{inqueue}}, $msg;
        }
+       $self->process_one;
 }
 
 # obtain a channel object by callsign [$obj = DXChannel::get($call)]
@@ -586,7 +587,7 @@ sub decode_input
 {
        my $dxchan = shift;
        my $data = shift;
-       my ($sort, $call, $line) = $data =~ /^([A-Z])([A-Z0-9\-]{3,9})\|(.*)$/;
+       my ($sort, $call, $line) = $data =~ /^([A-Z])([A-Z0-9\/\-]{3,25})\|(.*)$/;
 
        my $chcall = (ref $dxchan) ? $dxchan->call : "UN.KNOWN";
        
@@ -709,28 +710,28 @@ sub process_one
                
                # handle A records
                my $user = $self->user;
-               if ($sort eq 'A' || $sort eq 'O') {
-                       $self->start($line, $sort);
-               } elsif ($sort eq 'I') {
-                       die "\$user not defined for $call" if !defined $user;
+               if ($sort eq 'I') {
+                       die "\$user not defined for $call" unless defined $user;
                        
                        # normal input
                        $self->normal($line);
+               } elsif ($sort eq 'G') {
+                       $self->enhanced($line);
+               } elsif ($sort eq 'A' || $sort eq 'O') {
+                       $self->start($line, $sort);
                } elsif ($sort eq 'Z') {
                        $self->disconnect;
                } elsif ($sort eq 'D') {
                        ;                               # ignored (an echo)
-               } elsif ($sort eq 'G') {
-                       $self->enhanced($line);
                } else {
-                       dbg atime . " Unknown command letter ($sort) received from $call\n";
+                       dbg atime . " DXChannel::process_one: Unknown command letter ($sort) received from $call\n";
                }
        }
 }
 
 sub process
 {
-       foreach my $dxchan (get_all()) {
+       foreach my $dxchan (values %channels) {
                next if $dxchan->{disconnecting};
                $dxchan->process_one;
        }