From 9a61ef555083e7288a41de95d3709454c0a20625 Mon Sep 17 00:00:00 2001
From: minima <minima>
Date: Thu, 4 Jul 2002 21:59:06 +0000
Subject: [PATCH] added PC90 stuff

---
 cmd/set/pc90.pl    | 27 +++++++++++++++++++++++++++
 cmd/set/wwv.pl     | 18 +++++++++---------
 cmd/unset/pc90.pl  | 26 ++++++++++++++++++++++++++
 data/cty.dat       |  2 +-
 perl/DXProt.pm     | 27 +++++++++++++++++++++++----
 perl/DXUser.pm     | 19 ++++++++++---------
 perl/Messages      |  2 ++
 perl/Route/Node.pm |  2 ++
 8 files changed, 100 insertions(+), 23 deletions(-)
 create mode 100644 cmd/set/pc90.pl
 create mode 100644 cmd/unset/pc90.pl

diff --git a/cmd/set/pc90.pl b/cmd/set/pc90.pl
new file mode 100644
index 00000000..0aa8bea7
--- /dev/null
+++ b/cmd/set/pc90.pl
@@ -0,0 +1,27 @@
+#
+# set the pc90 flag
+#
+# Copyright (c) 1998 - Dirk Koopman
+#
+# $Id$
+#
+
+my ($self, $line) = @_;
+my @args = split /\s+/, $line;
+my $call;
+my @out;
+
+@args = $self->call if (!@args || $self->priv < 9);
+
+foreach $call (@args) {
+	$call = uc $call;
+	my $user = DXUser->get_current($call);
+	if ($user) {
+		$user->wantpc90(1);
+		$user->put;
+		push @out, $self->msg('pc90s', $call);
+	} else {
+		push @out, $self->msg('e3', "Set PC90", $call);
+	}
+}
+return (1, @out);
diff --git a/cmd/set/wwv.pl b/cmd/set/wwv.pl
index 1c1ff9cc..da06ebc1 100644
--- a/cmd/set/wwv.pl
+++ b/cmd/set/wwv.pl
@@ -14,14 +14,14 @@ my @out;
 @args = $self->call if (!@args || $self->priv < 9);
 
 foreach $call (@args) {
-  $call = uc $call;
-  my $chan = DXChannel->get($call);
-  if ($chan) {
-    DXChannel::wwv($chan, 1);
-    $chan->user->wantwwv(1);
-	push @out, $self->msg('wwvs', $call);
-  } else {
-    push @out, $self->msg('e3', "Set WWV", $call);
-  }
+	$call = uc $call;
+	my $chan = DXChannel->get($call);
+	if ($chan) {
+		DXChannel::wwv($chan, 1);
+		$chan->user->wantwwv(1);
+		push @out, $self->msg('wwvs', $call);
+	} else {
+		push @out, $self->msg('e3', "Set WWV", $call);
+	}
 }
 return (1, @out);
diff --git a/cmd/unset/pc90.pl b/cmd/unset/pc90.pl
new file mode 100644
index 00000000..466fc4ce
--- /dev/null
+++ b/cmd/unset/pc90.pl
@@ -0,0 +1,26 @@
+#
+# unset the pc90 flag
+#
+# Copyright (c) 1998 - Dirk Koopman
+#
+# $Id$
+#
+
+my ($self, $line) = @_;
+my @args = split /\s+/, $line;
+my $call;
+my @out;
+
+@args = $self->call if (!@args || $self->priv < 9);
+
+foreach $call (@args) {
+	$call = uc $call;
+	my $user = DXUser->get_current($call);
+	if ($user) {
+		$user->wantpc90(0);
+		push @out, $self->msg('pc90u', $call);
+	} else {
+		push @out, $self->msg('e3', "Unset PC90", $call);
+	}
+}
+return (1, @out);
diff --git a/data/cty.dat b/data/cty.dat
index 3710a706..985c0945 100644
--- a/data/cty.dat
+++ b/data/cty.dat
@@ -273,7 +273,7 @@ St. Pierre & Miquelon:    05:  09:  NA:   46.70:    56.00:     3.0:  FP:
 Reunion:                  39:  53:  AF:  -21.10:   -55.60:    -4.0:  FR:
     FR,TO0R,TO3R;
 Glorioso:                 39:  53:  AF:  -11.50:   -47.30:    -3.0:  FR/g:
-    FR/G,FR5AI,FR5ZQ/G,FR5ZU/G,FR7GL;
+    FR/G,FR5AI,FR5ZQ/G,FR5ZU/G,FR7GL,FR5HG/G;
 Juan de Nova & Europa:    39:  53:  AF:  -19.60:   -41.60:    -3.0:  FR/j:
     E,FR4FA,J;
 Tromelin:                 39:  53:  AF:  -15.90:   -54.40:    -4.0:  FR/t:
diff --git a/perl/DXProt.pm b/perl/DXProt.pm
index 59cdcf96..fc55f42d 100644
--- a/perl/DXProt.pm
+++ b/perl/DXProt.pm
@@ -1238,6 +1238,24 @@ sub normal
 			return;
 		}
 		if ($pcno == 90) {		# new style PC16,17,19,21
+			my $node = $field[1];
+
+			# mark this node as wanting PC90s
+			my $parent = Route::Node::get($node);
+			if ($parent) {
+				my $t = hex $field[2];
+				my $last = $parent->lastpc90 || 0;
+				if ($last < $t) {
+					$parent->pc90(1);
+					$parent->lastpc90($t); 
+					my ($updsort, $n) = unpack "AA*", $field[3];
+					for (my $i = 4; $i < $#field; $i++) {
+						my ($sort, $flag, $node, $ping) = $field[$i] =~ m{(\w)(\d)([-\w+])(,\d+)?};
+						$ping /= 10 if (defined $ping); 
+					}
+				}
+			}
+			
 			return;
 		}
 	}
@@ -1282,8 +1300,8 @@ sub process
 		next if $dxchan == $main::me;
 
 		# send the pc50 or PC90
-		if ($pc50s && $dxchan->is_spider) {
-#			$dxchan->send_route(\&pc90, 1, $main::me, 'T', @dxchan);
+		if ($pc50s && $dxchan->user->wantpc90) {
+			$dxchan->send_route(\&pc90, 1, $main::me, 'T', @dxchan);
 		} else {
 			$dxchan->send($pc50s) if $pc50s;
 		}
@@ -1567,7 +1585,7 @@ sub send_local_config
 		# and are not themselves isolated, this to make sure that isolated nodes
         # don't appear outside of this node
 		my @dxchan = grep { $_->call ne $main::mycall && $_ != $self && !$_->{isolate} } DXChannel::get_all_nodes();
-		@localnodes = map { my $r = Route::Node::get($_->{call}); $r ? $r : () } @dxchan if @dxchan;
+		@localnodes = map { my $r = Route::Node::get($_->{call}); $r ? $r : () } @dxchan if @dxchan && !$self->user->wantpc90;
 		my @intcalls = map { $_->nodes } @localnodes if @localnodes;
 		my $ref = Route::Node::get($self->{call});
 		my @rnodes = $ref->nodes;
@@ -1577,6 +1595,7 @@ sub send_local_config
 		unshift @localnodes, $main::routeroot;
 	}
 	
+
 	send_route($self, \&pc19, scalar(@localnodes)+scalar(@remotenodes), @localnodes, @remotenodes);
 	
 	# get all the users connected on the above nodes and send them out
@@ -1587,7 +1606,7 @@ sub send_local_config
 			dbg("sent a null value") if isdbg('chanerr');
 		}
 	}
-#	$self->send_route(\&pc90, 1, $main::me, 'T', DXChannel::get_all());
+	$self->send_route(\&pc90, 1, $main::me, 'T', DXChannel::get_all()) if $self->user->wantpc90;
 }
 
 #
diff --git a/perl/DXUser.pm b/perl/DXUser.pm
index bfc861de..316b7fad 100644
--- a/perl/DXUser.pm
+++ b/perl/DXUser.pm
@@ -57,21 +57,22 @@ $lasttime = 0;
 		  hmsgno => '0,Highest Msgno',
 		  group => '0,Access Group,parray',	# used to create a group of users/nodes for some purpose or other
 		  isolate => '9,Isolate network,yesno',
-		  wantbeep => '0,Rec Beep,yesno',
-		  wantann => '0,Rec Announce,yesno',
-		  wantwwv => '0,Rec WWV,yesno',
-		  wantwcy => '0,Rec WCY,yesno',
-		  wantecho => '0,Rec Echo,yesno',
-		  wanttalk => '0,Rec Talk,yesno',
-		  wantwx => '0,Rec WX,yesno',
-		  wantdx => '0,Rec DX Spots,yesno',
-		  wantemail => '0,Rec Msgs as Email,yesno',
+		  wantbeep => '0,Req Beep,yesno',
+		  wantann => '0,Req Announce,yesno',
+		  wantwwv => '0,Req WWV,yesno',
+		  wantwcy => '0,Req WCY,yesno',
+		  wantecho => '0,Req Echo,yesno',
+		  wanttalk => '0,Req Talk,yesno',
+		  wantwx => '0,Req WX,yesno',
+		  wantdx => '0,Req DX Spots,yesno',
+		  wantemail => '0,Req Msgs as Email,yesno',
 		  pagelth => '0,Current Pagelth',
 		  pingint => '9,Node Ping interval',
 		  nopings => '9,Ping Obs Count',
 		  wantlogininfo => '9,Login info req,yesno',
           wantgrid => '0,DX Grid Info,yesno',
 		  wantann_talk => '0,Talklike Anns,yesno',
+		  wantpc90 => '1,Req PC90,yesno',
 		  lastoper => '9,Last for/oper,cldatetime',
 		  nothere => '0,Not Here Text',
 		  registered => '9,Registered?,yesno',
diff --git a/perl/Messages b/perl/Messages
index d396c54f..0098094a 100644
--- a/perl/Messages
+++ b/perl/Messages
@@ -197,6 +197,8 @@ package DXM;
 				passerr => 'Please use: SET/PASS <password> <callsign>',
 				password => 'Password set or changed for $_[0]',
 				passwordu => 'Password removed for $_[0]',
+				pc90s => 'PC90 enabled for $_[0]',
+				pc90u => 'PC90 disabled $_[0]',
 				pingo => 'Ping Started to $_[0]',
 				pingi => 'Ping Returned from $_[0] $_[1] (Ave $_[2]) secs',
 				pinge1 => 'Cannot ping yourself!',
diff --git a/perl/Route/Node.pm b/perl/Route/Node.pm
index 2a9c585d..e7a6f8e4 100644
--- a/perl/Route/Node.pm
+++ b/perl/Route/Node.pm
@@ -29,6 +29,8 @@ use vars qw(%list %valid @ISA $max $filterdef);
 		  users => '0,Users,parray',
 		  usercount => '0,User Count',
 		  version => '0,Version',
+		  pc90 => '0,Using PC90,yesno',
+		  lastpc90 => '0,Last PC90 time,cldatetime',
 );
 
 $filterdef = $Route::filterdef;
-- 
2.43.0