From cbda6153fad2adddb58ee5a87f3981aa2ad754ad Mon Sep 17 00:00:00 2001
From: minima <minima>
Date: Mon, 22 Jan 2007 13:59:59 +0000
Subject: [PATCH] change do_pc92 to do_pc9x

---
 perl/DXChannel.pm    |  3 +--
 perl/DXProt.pm       | 19 +++++++++----------
 perl/DXProtHandle.pm | 25 ++++++++++++-------------
 perl/DXProtout.pm    |  2 +-
 perl/Route/Node.pm   |  2 +-
 perl/RouteDB.pm      |  8 +++-----
 perl/cluster.pl      |  2 +-
 7 files changed, 28 insertions(+), 33 deletions(-)

diff --git a/perl/DXChannel.pm b/perl/DXChannel.pm
index 98617515..2337d959 100644
--- a/perl/DXChannel.pm
+++ b/perl/DXChannel.pm
@@ -119,8 +119,7 @@ $count = 0;
 		  lastmsgpoll => '0,Last Msg Poll,atime',
 		  inscript => '9,In a script,yesno',
 		  handle_xml => '9,Handles XML,yesno',
-		  do_pc92 => '9,Handles PC92,yesno',
-		  do_pc93 => '9,Handles PC93,yesno',
+		  do_pc9x => '9,Handles PC9x,yesno',
 		  inqueue => '9,Input Queue,parray',
 		 );
 
diff --git a/perl/DXProt.pm b/perl/DXProt.pm
index 4e32c22e..220c689c 100644
--- a/perl/DXProt.pm
+++ b/perl/DXProt.pm
@@ -221,8 +221,7 @@ sub init
 	$main::me->{registered} = 1;
 	$main::me->{version} = $main::version;
 	$main::me->{build} = $main::build;
-	$main::me->{do_pc92} = 1;
-	$main::me->{via_pc92} = 1;
+	$main::me->{do_pc9x} = 1;
 }
 
 #
@@ -735,7 +734,7 @@ sub send_local_config
 	dbg('DXProt::send_local_config') if isdbg('trace');
 
 	# send our nodes
-	if ($self->{do_pc92}) { 
+	if ($self->{do_pc9x}) { 
 		$self->send_pc92_config;
 	} else {
 		my $node;
@@ -815,7 +814,7 @@ sub gen_pc92_update
 	if ($with_pc92_nodes) {
 		# send out the configuration of all the directly connected PC92 nodes with current configuration
 		# but with the dates that the last config came in with.
-		@dxchan = grep { $_->call ne $main::mycall && $_ != $self && !$_->{isolate} && $_->{do_pc92} } DXChannel::get_all_nodes();
+		@dxchan = grep { $_->call ne $main::mycall && $_ != $self && !$_->{isolate} && $_->{do_pc9x} } DXChannel::get_all_nodes();
 		dbg("ROUTE: pc92 dxchan: " . join(',', map{$_->{call}} @dxchan)) if isdbg('routelow');
 		@localnodes = map { my $r = Route::Node::get($_->{call}); $r ? $r : () } @dxchan;
 		dbg("ROUTE: pc92 localnodes: " . join(',', map{$_->{call}} @localnodes)) if isdbg('routelow');
@@ -829,7 +828,7 @@ sub gen_pc92_update
 	
 	# send the configuration of all the directly connected 'external' nodes that don't handle PC92
 	# out with the 'external' marker on the first node.
-	@dxchan = grep { $_->call ne $main::mycall && $_ != $self && !$_->{isolate} && !$_->{do_pc92} } DXChannel::get_all_nodes();
+	@dxchan = grep { $_->call ne $main::mycall && $_ != $self && !$_->{isolate} && !$_->{do_pc9x} } DXChannel::get_all_nodes();
 	dbg("ROUTE: non pc92 dxchan: " . join(',', map{$_->{call}} @dxchan)) if isdbg('routelow');
 	@localnodes = map { my $r = Route::Node::get($_->{call}); $r ? $r : () } @dxchan;
 	dbg("ROUTE: non pc92 localnodes: " . join(',', map{$_->{call}} @localnodes)) if isdbg('routelow');
@@ -870,7 +869,7 @@ sub send_pc92_update
 
 sub time_out_pc92_routes
 {
-	my @nodes = grep {$_->call ne $main::mycall && ($_->do_pc92 || $_->via_pc92)} Route::Node::get_all();
+	my @nodes = grep {$_->call ne $main::mycall && ($_->do_pc9x || $_->via_pc92)} Route::Node::get_all();
 	my @rdel;
 	foreach my $n (@nodes) {
 		my $o = $n->dec_obs;
@@ -1159,7 +1158,7 @@ sub talk
 {
 	my ($self, $from, $to, $via, $line, $origin) = @_;
 	
-	if ($self->{do_pc93}) {
+	if ($self->{do_pc9x}) {
 		$self->send(pc93($to, $from, $via, $line));
 	} else {
 		$self->send(pc10($from, $to, $via, $line, $origin));
@@ -1232,7 +1231,7 @@ sub broadcast_route
 			next if $dxchan == $self;
 			next if $dxchan == $main::me;
 			next unless $dxchan->isa('DXProt');
-			next if $dxchan->{do_pc92};
+			next if $dxchan->{do_pc9x};
 			next if ($generate == \&pc16 || $generate==\&pc17) && !$dxchan->user->wantsendpc16;
  
 			$dxchan->send_route($origin, $generate, @_);
@@ -1245,7 +1244,7 @@ sub send_route_pc92
 {
 	my $self = shift;
 
-	return unless $self->{do_pc92};
+	return unless $self->{do_pc9x};
 	
 	my $origin = shift;
 	my $generate = shift;
@@ -1275,7 +1274,7 @@ sub broadcast_route_pc9x
 		foreach $dxchan (@dxchan) {
 			next if $dxchan == $self || $dxchan == $main::me;
 			next if $origin eq $dxchan->{call};	# don't route some from this call back again.
-			next unless $dxchan->{do_pc92};
+			next unless $dxchan->{do_pc9x};
 			next unless $dxchan->isa('DXProt');
 
 			$dxchan->send($line);
diff --git a/perl/DXProtHandle.pm b/perl/DXProtHandle.pm
index 938d0fbc..44a1ecc2 100644
--- a/perl/DXProtHandle.pm
+++ b/perl/DXProtHandle.pm
@@ -610,10 +610,8 @@ sub handle_18
 			$self->sort('S');
 		}
 		$self->{handle_xml}++ if DXXml::available() && $_[1] =~ /\bxml/;
-		my ($pc9x) = $_[1] =~ /\bpc9\[(\d+)\]/;
-		if (defined $pc9x) {
-			$self->{do_pc92}++ if $pc9x =~ /2/;
-			$self->{do_pc93}++ if $pc9x =~ /3/;
+		if ($_[1] =~ /\bpc9x/) {
+			$self->{do_pc9x}++;
 		}
 	} else {
 		$self->version(50.0);
@@ -788,7 +786,7 @@ sub send_delayed_pc92
 	$self->broadcast_route_pc9x($main::mycall, undef, $line, 0);
 
 	# if this is an external node then send out the external config
-	unless ($self->{do_pc92}) {
+	unless ($self->{do_pc9x}) {
 		$line = gen_my_pc92_config(Route::Node::get($self->{call}));
 		$self->broadcast_route_pc9x($main::mycall, undef, $line, 0);
 	}
@@ -802,7 +800,7 @@ sub handle_20
 	my $line = shift;
 	my $origin = shift;
 
-	if ($self->{do_pc92} && $self->{state} ne 'init92') {
+	if ($self->{do_pc9x} && $self->{state} ne 'init92') {
 		dbg("PCPROT: disconnecting because login call not sent in any pc92") if isdbg('chanerr');
 		$self->send("**** You logged in with $self->{call} but that is NOT your \$mycall");
 		$self->disconnect;
@@ -887,7 +885,7 @@ sub handle_22
 	my $line = shift;
 	my $origin = shift;
 
-	if ($self->{do_pc92}) {
+	if ($self->{do_pc9x}) {
 		if ($self->{state} ne 'init92') {
 			dbg("PCPROT: disconnecting because login call not sent in any pc92") if isdbg('chanerr');
 			$self->send("**** You logged in with $self->{call} but that is NOT your \$mycall");
@@ -1366,7 +1364,7 @@ sub _encode_pc92_call
 	if ($ref->isa('Route::Node') || $ref->isa('DXProt')) {
 		$flag |= 4;
 		my $dxchan = DXChannel::get($call);
-		$flag |= 2 if $call ne $main::mycall && $dxchan && !$dxchan->{do_pc92};
+		$flag |= 2 if $call ne $main::mycall && $dxchan && !$dxchan->{do_pc9x};
 		if ($ext) {
 			if ($ref->version) {
 				my $version = $ref->version || 1.0;
@@ -1464,7 +1462,7 @@ sub handle_92
 
 	my (@radd, @rdel);
 	
-	$self->{do_pc92} ||= 1;
+	$self->{do_pc9x} ||= 1;
 
 	my $pcall = $_[1];
 	unless ($pcall) {
@@ -1488,7 +1486,7 @@ sub handle_92
 	my $oparent = $parent;
 	
 	$parent->lastid->{92} = $t;
-	$parent->do_pc92(1);
+	$parent->do_pc9x(1);
 	$parent->via_pc92(1);
 
 	if (@ent) {
@@ -1612,7 +1610,7 @@ sub handle_93
 	my $line = shift;
 	my $origin = shift;
 
-	$self->{do_pc93} ||= 1;
+	$self->{do_pc9x} ||= 1;
 
 	my $pcall = $_[1];
 	unless (is_callsign($pcall)) {
@@ -1646,7 +1644,8 @@ sub handle_93
 
 	if (is_callsign($to)) {
 		# local talks 
-		my $dxchan = DXChannel::get($main::myalias) if $to eq $main::mycall;
+		my $dxchan;
+		$dxchan = DXChannel::get($main::myalias) if $to eq $main::mycall;
 		$dxchan = DXChannel::get($to) unless $dxchan;
 		if ($dxchan && $dxchan->is_user) {
 			$dxchan->talk($from, $to, $via, $text);
@@ -1658,7 +1657,7 @@ sub handle_93
 		if ($ref) {
 			my @dxchan = $ref->alldxchan;
 			for $dxchan (@dxchan) {
-				if ($dxchan->{do_pc93}) {
+				if ($dxchan->{do_pc9x}) {
 					$dxchan->send($line);
 				} else {
 					$dxchan->talk($from, $to, $via, $text);
diff --git a/perl/DXProtout.pm b/perl/DXProtout.pm
index 118261ef..4fbb581c 100644
--- a/perl/DXProtout.pm
+++ b/perl/DXProtout.pm
@@ -120,7 +120,7 @@ sub pc17
 # Request init string
 sub pc18
 {
-	my $flags = " pc9[23]";
+	my $flags = " pc9x";
 	$flags .= " xml" if DXXml::available(); 
 	return "PC18^DXSpider Version: $main::version Build: $main::build$flags^$DXProt::myprot_version^";
 }
diff --git a/perl/Route/Node.pm b/perl/Route/Node.pm
index e50302cd..d27efbf8 100644
--- a/perl/Route/Node.pm
+++ b/perl/Route/Node.pm
@@ -30,7 +30,7 @@ use vars qw(%list %valid @ISA $max $filterdef $obscount);
 		  handle_xml => '0,Using XML,yesno',
 		  lastmsg => '0,Last Route Msg,atime',
 		  lastid => '0,Last Route MsgID',
-		  do_pc92 => '0,Uses pc92,yesno',
+		  do_pc9x => '0,Uses pc9x,yesno',
 		  via_pc92 => '0,Came in via pc92,yesno',
 		  obscount => '0,Obscount',
 );
diff --git a/perl/RouteDB.pm b/perl/RouteDB.pm
index 96d0b0b4..bff21fb4 100644
--- a/perl/RouteDB.pm
+++ b/perl/RouteDB.pm
@@ -20,18 +20,16 @@ package RouteDB;
 
 use DXDebug;
 use DXChannel;
+use DXUtil;
 use Prefix;
 
 use strict;
 
 use vars qw($VERSION $BRANCH);
-$VERSION = sprintf( "%d.%03d", q$Revision$ =~ /(\d+)\.(\d+)/ );
-$BRANCH = sprintf( "%d.%03d", q$Revision$ =~ /\d+\.\d+\.(\d+)\.(\d+)/  || (0,0));
-$main::build += $VERSION;
-$main::branch += $BRANCH;
-
 use vars qw(%list %valid $default);
 
+($VERSION, $BRANCH) = dxver(q$Revision$);
+
 %list = ();
 $default = 99;					# the number of hops to use if we don't know
 %valid = (
diff --git a/perl/cluster.pl b/perl/cluster.pl
index fe881f1e..2c8b5f65 100755
--- a/perl/cluster.pl
+++ b/perl/cluster.pl
@@ -462,7 +462,7 @@ DXProt->init();
 
 # put in a DXCluster node for us here so we can add users and take them away
 $routeroot = Route::Node->new($mycall, $version*100+5300, Route::here($main::me->here)|Route::conf($main::me->conf));
-$routeroot->do_pc92(1);
+$routeroot->do_pc9x(1);
 $routeroot->via_pc92(1);
 
 # make sure that there is a routing OUTPUT node default file
-- 
2.43.0