I think I have most the SSID probs cracked.
[spider.git] / perl / DXCluster.pm
index 6daf65a3874a5ebfd29ba8326e45b13b733854d0..25dafaed20d249cdafd994823d42dfdd068e9c2c 100644 (file)
@@ -49,11 +49,45 @@ sub alloc
   return $self;
 }
 
+# get an entry exactly as it is
+sub get_exact
+{
+  my ($pkg, $call) = @_;
+
+  # belt and braces
+  $call = uc $call;
+  
+  # search for 'as is'
+  return $cluster{$call}; 
+}
+
+#
 # search for a call in the cluster
+# taking into account SSIDs
+#
 sub get
 {
   my ($pkg, $call) = @_;
-  return $cluster{$call};
+
+  # belt and braces
+  $call = uc $call;
+  
+  # search for 'as is'
+  my $ref = $cluster{$call}; 
+  return $ref if $ref;
+
+  # search for the unSSIDed one
+  $call =~ s/-\d+$//o;
+  $ref = $cluster{$call};
+  return $ref if $ref;
+  
+  # search for the SSIDed one
+  my $i;
+  for ($i = 1; $i < 17; $i++) {
+         $ref = $cluster{"$call-$i"};
+         return $ref if $ref;
+  }
+  return undef;
 }
 
 # get all 
@@ -97,8 +131,9 @@ sub cluster
 {
        my $users = DXCommandmode::get_all();
        my $uptime = main::uptime();
-       
-       return " $DXNode::nodes nodes, $users local / $DXNode::users total users  Max users $DXNode::maxusers  Uptime $uptime";
+       my $tot = $DXNode::users + 1;
+               
+       return " $DXNode::nodes nodes, $users local / $tot total users  Max users $DXNode::maxusers  Uptime $uptime";
 }
 
 sub DESTROY
@@ -136,7 +171,7 @@ sub new
 {
   my ($pkg, $dxchan, $node, $call, $confmode, $here) = @_;
 
-  die "tried to add $call when it already exists" if DXCluster->get($call);
+  die "tried to add $call when it already exists" if DXCluster->get_exact($call);
   
   my $self = $pkg->alloc($dxchan, $call, $confmode, $here);
   $self->{mynode} = $node;