added logging
[spider.git] / perl / DXProt.pm
index 552468b92cf9ab22a0407a2fdd7ea77fcb2706fb..ab9e0e33fd0af91dbf9b83e8b45d53672d212cac 100644 (file)
@@ -18,6 +18,7 @@ use DXM;
 use DXCluster;
 use DXProtVars;
 use DXCommandmode;
+use DXLog;
 use Spot;
 use DXProtout;
 use Carp;
@@ -68,6 +69,7 @@ sub start
   $self->send(pc18());
   $self->state('init');
   $self->pc50_t(time);
+  Log('DXProt', "$call connected");
 }
 
 #
@@ -252,14 +254,17 @@ sub normal
        
     if ($pcno == 21) {             # delete a cluster from the list
          my $call = uc $field[1];
-         my $ref = DXCluster->get($call);
-         $ref->del() if $ref;
+         if ($call ne $main::mycall) {              # don't allow malicious buggers to disconnect me!
+           my $ref = DXCluster->get($call);
+           $ref->del() if $ref;
+         }
          last SWITCH;
        }
        
     if ($pcno == 22) {last SWITCH;}
 
     if ($pcno == 23 || $pcno == 27) {  # WWV info
+         Geomag::update(@field[1..$#field]);
       last SWITCH;
        }
 
@@ -299,6 +304,7 @@ sub normal
        
     if ($pcno == 41) {              # user info
       # add this station to the user database, if required
+         $field[1] =~ s/-\d+$//o;
          my $user = DXUser->get_current($field[1]);
          $user = DXUser->new($field[1]) if !$user;
          
@@ -423,6 +429,7 @@ sub finish
 
   # now broadcast to all other ak1a nodes that I have gone
   broadcast_ak1a(pc21($self->call, 'Gone.'), $self);
+  Log('DXProt', $self->call . " Disconnected");
   $ref->del() if $ref;
 }