added registration
[spider.git] / cmd / send.pl
index d6e502cd4f1d82840335fe5bed9c1a1ec389adde..9cee791550ca4aa94e4d77d69bcab18cc26a7bd3 100644 (file)
@@ -32,10 +32,12 @@ $loc->{rrreq} = '0';
 
 if ($self->state eq "prompt") {
 
-       my @f = split /\s+/, $line;
-
+       my @f = split /([\s\@\$])/, $line;
+       @f = map {s/\s+//g; length $_ ? $_ : ()} @f;
+       
        # any thing after send?
        return (1, $self->msg('e6')) if !@f;
+       return (1, $self->msg('e28')) unless $self->registered || uc $f[0] eq $main::myalias;
 
        while (@f) {
                my $f = uc shift @f; 
@@ -94,14 +96,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 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 +142,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