From 14f2cd924047e8d99aa2f5796f8f34ee80802651 Mon Sep 17 00:00:00 2001 From: minima Date: Wed, 3 Oct 2001 11:17:03 +0000 Subject: [PATCH] more fixes to bbs syntax --- cmd/send.pl | 18 ++++++++++++------ perl/DXMsg.pm | 12 +++++++----- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/cmd/send.pl b/cmd/send.pl index 59b535f7..71cea2bc 100644 --- a/cmd/send.pl +++ b/cmd/send.pl @@ -33,7 +33,8 @@ $loc->{rrreq} = '0'; if ($self->state eq "prompt") { my @f = split /\b/, $line; - + @f = map {s/\s+//g; length $_ ? $_ : ()} @f; + # any thing after send? return (1, $self->msg('e6')) if !@f; @@ -94,14 +95,14 @@ if ($self->state eq "prompt") { $loc->{rrreq} = '1'; } elsif ($f eq '<' && @f) { # this is bbs syntax for from call $loc->{from} = uc shift @f; - } elsif (($f =~ /^[\@\.\#]$/ || $f eq '.#') && @f) { # this is bbs syntax, for send it 'to node' + } elsif (($f =~ /^[\@\.\#\$]$/ || $f eq '.#') && @f) { # this is bbs syntax, for send it 'to node' shift @f; } elsif ($f =~ /^\$/) { # this is bbs syntax for a bid next; - } elsif ($f =~ /^<\S+/) { # this is bbs syntax for from call - ($loc->{from}) = $f =~ /^<(\S+)$/; - } elsif ($f =~ /^\@\S+/) { # this is bbs syntax for origin - ($loc->{origin}) = $f =~ /^\@(\S+)$/; + } elsif ($f =~ /^<(\S+)/) { # this is bbs syntax for from call + $loc->{from} = $1; + } elsif ($f =~ /^\$\S+/) { # this is bbs syntax for bid + ; } else { # callsign ? @@ -140,6 +141,11 @@ if ($self->state eq "prompt") { delete $self->{loc}; return (1, $self->msg('e6')); } + $loc->{from} ||= $self->call; + unless (is_callsign($loc->{from})) { + delete $self->{loc}; + return (1, $self->msg('e22', $loc->{from})); + } # find me and set the state and the function on my state variable to # keep calling me for every line until I relinquish control diff --git a/perl/DXMsg.pm b/perl/DXMsg.pm index 3d83359d..54a2c6f3 100644 --- a/perl/DXMsg.pm +++ b/perl/DXMsg.pm @@ -1208,6 +1208,8 @@ sub import_one # first line; my $line = shift @$ref; my @f = split /\b/, $line; + @f = map {s/\s+//g; length $_ ? $_ : ()} @f; + unless (@f && $f[0] =~ /^(:?S|SP|SB|SEND)$/ ) { my $m = "invalid first line in import '$line'"; dbg($m) if isdbg('msg'); @@ -1224,16 +1226,16 @@ sub import_one ; } elsif ($notincalls && ($f eq 'RR')) { $rr = '1'; - } elsif (($f =~ /^[\@\.\#]$/ || $f eq '.#') && @f) { # this is bbs syntax, for AT + } elsif (($f =~ /^[\@\.\#\$]$/ || $f eq '.#') && @f) { # this is bbs syntax, for AT shift @f; } elsif ($f eq '<' && @f) { # this is bbs syntax for from call $from = uc shift @f; } elsif ($f =~ /^\$/) { # this is bbs syntax for a bid next; - } elsif ($f =~ /^<\S+/) { # this is bbs syntax for from call - ($from) = $f =~ /^<(\S+)$/; - } elsif ($f =~ /^\@\S+/) { # this is bbs syntax for origin - ($origin) = $f =~ /^\@(\S+)$/; + } elsif ($f =~ /^<(\S+)/) { # this is bbs syntax for from call + $from = $1; + } elsif ($f =~ /^\$\S+/) { # this is bbs syntax for bid + ; } else { # callsign ? -- 2.34.1