X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FDXMsg.pm;h=7cef3adb4f8f5bb7a8415e8a3cf196d8c20e53a4;hb=5ba68ecc9ddb9ccdefe75256f73af2ba92fd221c;hp=88371ed787a3e08119d4c2a22a42af7a0a5d487b;hpb=ed8842a3d38de2c171329e51612d2dc520ffcc99;p=spider.git 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 } ; + my @msg = map { chomp; $_ } ; 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')); } } }