change build number calculation to be more accurate
[spider.git] / perl / DXCluster.pm
index f87dfdfcf00550318f1e6566a8245d731a3d8d1b..8338cccb5a511c3da8e0d1096a5679d6520424fe 100644 (file)
@@ -27,12 +27,18 @@ use vars qw(%cluster %valid);
                  call => '0,Callsign',
                  confmode => '0,Conference Mode,yesno',
                  here => '0,Here?,yesno',
-                 dxchan => '5,Channel Call',
+                 dxchancall => '5,Channel Call',
                  pcversion => '5,Node Version',
                  list => '5,User List,DXCluster::dolist',
                  users => '0,No of Users',
                 );
 
+use vars qw($VERSION $BRANCH);
+$VERSION = sprintf( "%d.%03d", q$Revision$ =~ /(\d+)\.(\d+)/ );
+$BRANCH = sprintf( "%d.%03d", q$Revision$ =~ /\d+\.\d+\.(\d+)\.(\d+)/ ) || 0;
+$main::build += $VERSION;
+$main::branch += $BRANCH;
+
 sub alloc
 {
        my ($pkg, $dxchan, $call, $confmode, $here) = @_;
@@ -41,7 +47,7 @@ sub alloc
        $self->{call} = $call;
        $self->{confmode} = $confmode;
        $self->{here} = $here;
-       $self->{dxchan} = $dxchan->call;
+       $self->{dxchancall} = $dxchan->call;
 
        $cluster{$call} = bless $self, $pkg;
        return $self;
@@ -155,7 +161,7 @@ sub mynode
                unless ($noderef) {
                        my $mynode = $self->{mynode};
                        my $call = $self->{call};
-                       dbg('err', "parent node $mynode has disappeared from $call" );
+                       dbg("parent node $mynode has disappeared from $call") if isdbg('err');
                }
        }
        return $noderef;
@@ -167,13 +173,13 @@ sub dxchan
        my $dxchan = shift;
 
        if ($dxchan) {
-               $self->{dxchan} = $dxchan->call;
+               $self->{dxchancall} = $dxchan->call;
        } else {
-               $dxchan = DXChannel->get($self->{dxchan});
+               $dxchan = DXChannel->get($self->{dxchancall});
                unless ($dxchan) {
-                       my $dxcall = $self->{dxchan};
+                       my $dxcall = $self->{dxchancall};
                        my $call = $self->{call};
-                       dbg('err', "parent dxchan $dxcall has disappeared from $call" );
+                       dbg("parent dxchan $dxcall has disappeared from $call") if isdbg('err');
                }
        }
        return $dxchan;
@@ -216,7 +222,7 @@ sub new
        my $self = $pkg->alloc($dxchan, $call, $confmode, $here);
        $self->{mynode} = $node->call;
        $node->add_user($call, $self);
-       dbg('cluster', "allocating user $call to $node->{call} in cluster\n");
+       dbg("allocating user $call to $node->{call} in cluster\n") if isdbg('cluster');
        return $self;
 }
 
@@ -227,7 +233,7 @@ sub del
        my $node = $self->mynode;
 
        $node->del_user($call);
-       dbg('cluster', "deleting user $call from $node->{call} in cluster\n");
+       dbg("deleting user $call from $node->{call} in cluster\n") if isdbg('cluster');
 }
 
 sub count
@@ -264,7 +270,7 @@ sub new
        $self->{mynode} = $self->call;  # for sh/station
        $self->{users} = 0;
        $nodes++;
-       dbg('cluster', "allocating node $call to cluster\n");
+       dbg("allocating node $call to cluster\n") if isdbg('cluster');
        return $self;
 }
 
@@ -290,7 +296,7 @@ sub del
                $ref->del();                    # this also takes them out of this list
        }
        delete $DXCluster::cluster{$call}; # remove me from the cluster table
-       dbg('cluster', "deleting node $call from cluster\n"); 
+       dbg("deleting node $call from cluster\n") if isdbg('cluster'); 
        $users -= $self->{users};    # it may be PC50 updated only therefore > 0
        $users = 0 if $users < 0;
        $nodes--;