From 866bd5c7cd0fd6c8167d6e6a0c9acfe5feb0ba65 Mon Sep 17 00:00:00 2001
From: djk <djk>
Date: Mon, 27 Mar 2000 13:30:48 +0000
Subject: [PATCH] fixed ITU on 4W fixed CQ on TX0 fixed message importing

---
 data/prefix_data.pl |  4 ++--
 data/wpxloc.raw     |  6 ++++--
 perl/DXMsg.pm       | 18 ++++++++++++------
 3 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/data/prefix_data.pl b/data/prefix_data.pl
index 5f8b16af..1cf2c9b7 100644
--- a/data/prefix_data.pl
+++ b/data/prefix_data.pl
@@ -3233,7 +3233,7 @@
    541 => bless( { name => 'So-Africa-ZS', dxcc => 265, itu => 57, cq => 38, utcoff => -2.0, lat => -33.9, long => 18.4 }, 'Prefix'),
    542 => bless( { name => 'So-Africa-ZS', dxcc => 265, itu => 57, cq => 38, utcoff => -2.0, lat => -28.5, long => 27 }, 'Prefix'),
    543 => bless( { name => 'So-Africa-ZS', dxcc => 265, itu => 57, cq => 38, utcoff => -2.0, lat => -29.9, long => 30.9 }, 'Prefix'),
-   544 => bless( { name => 'East-Timor-4W', dxcc => 340, itu => 51, cq => 28, utcoff => -8.0, lat => -9.21666666666667, long => 126.5 }, 'Prefix'),
-   545 => bless( { name => 'Chesterfield-Is-TX0', dxcc => 341, itu => 56, cq => 32, utcoff => -11.0, lat => -19.5166666666667, long => 158.183333333333 }, 'Prefix'),
+   544 => bless( { name => 'East-Timor-4W', dxcc => 340, itu => 54, cq => 28, utcoff => -8.0, lat => -9.21666666666667, long => 126.5 }, 'Prefix'),
+   545 => bless( { name => 'Chesterfield-Is-TX0', dxcc => 341, itu => 56, cq => 30, utcoff => -11.0, lat => -19.5166666666667, long => 158.183333333333 }, 'Prefix'),
 );
 
diff --git a/data/wpxloc.raw b/data/wpxloc.raw
index 65b3d0de..20449073 100644
--- a/data/wpxloc.raw
+++ b/data/wpxloc.raw
@@ -1,5 +1,7 @@
 ! highest DXCC number is now 341
 !
+! added 4W to 340                             000327
+! added TX0 to 341                            000327
 ! changed FO/M (Marquesas) to 339             991111
 ! changed FO/A (Austral) to 338               991111
 ! changed 3C0 to S latitude                   991111
@@ -881,8 +883,8 @@ ZS6 So-Africa-ZS                265 57 38 -2.0 26 12 0 S 28 6 0 E
 ZS2 Marion-Is-ZS8               266 57 38 -2.0 46 48 0 S 37 48 0 E
 ZS8 Marion-Is-ZS8               266 57 38 -2.0 46 48 0 S 37 48 0 E @
 V50,V51 Namibia-V5              267 57 38 -2.0 22 36 0 S 17 6 0 E
-4W East-Timor-4W				340 51 28 -8.0 8 73 0 S 126 30 0 E  
-TX0 Chesterfield-Is-TX0         341 56 32 -11.0 19 31 0 S 158 11 0 E
+4W East-Timor-4W				340 54 28 -8.0 8 73 0 S 126 30 0 E  
+TX0 Chesterfield-Is-TX0         341 56 30 -11.0 19 31 0 S 158 11 0 E
 T0,SSB,1B,X5,X8,ZC6,10G,50V,Q,0,MAJ Pirat_Country 666 17 14 -0.0 0 0 0 S 0 0 0 E @
 
 
diff --git a/perl/DXMsg.pm b/perl/DXMsg.pm
index 88371ed7..7cef3adb 100644
--- a/perl/DXMsg.pm
+++ b/perl/DXMsg.pm
@@ -1057,7 +1057,7 @@ sub import_msgs
 	closedir(DIR);
 	my $name;
 	foreach $name (@names) {
-		next if $name =~ /^./;
+		next if $name =~ /^\./;
 		my $fn = "$importfn/$name";
 		next unless -f $fn;
 		unless (open(MSG, $fn)) {
@@ -1066,7 +1066,7 @@ sub import_msgs
 			unlink($fn);
 			next;
 		}
-		my @msg = map { chomp } <MSG>;
+		my @msg = map { chomp; $_ } <MSG>;
 		close(MSG);
 		unlink($fn);
 		my @out = import_one($DXProt::me, \@msg);
@@ -1089,7 +1089,13 @@ sub import_one
 	my @out;
 				
 	# first line;
-	my @f = split /\s+/, shift @$ref;
+	my $line = shift @$ref;
+	my @f = split /\s+/, $line;
+	unless ($f[0] =~ /^(:?S|SP|SB|SEND)$/ ) {
+		my $m = "invalid first line in import '$line'";
+		dbg('MSG', $m );
+		return (1, $m);
+	}
 	while (@f) {
 		my $f = uc shift @f;
 		next if $f eq 'SEND';
@@ -1147,7 +1153,7 @@ sub import_one
 	pop @$ref while (@$ref && ($$ref[-1] eq '' || $$ref[-1] =~ /^\s+$/));
 
 	# strip off /EX or /ABORT
-	return () if (@$ref && $$ref[-1] =~ m{^/ABORT$}i); 
+	return ("aborted") if (@$ref && $$ref[-1] =~ m{^/ABORT$}i); 
 	pop @$ref if (@$ref && $$ref[-1] =~ m{^/EX$}i);									 
 
     # write all the messages away
@@ -1166,12 +1172,12 @@ sub import_one
 							$rr);
 		$mref->store($ref);
 		$mref->add_dir();
-		push @out, $dxchan->msg('m11', $ref->{msgno}, $to);
+		push @out, $dxchan->msg('m11', $mref->{msgno}, $to);
 		#push @out, "msgno $ref->{msgno} sent to $to";
 		my $todxchan = DXChannel->get(uc $to);
 		if ($todxchan) {
 			if ($todxchan->is_user()) {
-				$todxchan->send($dxchan->msg('m9'));
+				$todxchan->send($todxchan->msg('m9'));
 			}
 		}
 	}
-- 
2.43.0