6 # send <call> [<call> .. ]
7 # send private <call> [<call> .. ]
8 # send private rr <call> [<call> .. ]
9 # send rr <call> [<call> .. ]
10 # send noprivate <call> [<call> .. ]
11 # send b <call> [<call> .. ]
12 # send copy <call> [<call> .. ]
13 # send copy rr <call> [<call> .. ]
15 # Copyright (c) Dirk Koopman G1TLH
19 my ($self, $line) = @_;
20 return (1, $self->msg('e5')) if $self->remotecmd || $self->inscript;
21 return (1, $self->msg('e36')) unless $self->state =~ /^prompt/;
24 my $loc = $self->{loc} = {};
29 $loc->{private} = '1';
34 if ($self->state eq "prompt") {
36 my @f = split /([\s\@\$,])/, $line;
37 @f = map {s/\s+//g; length $_ ? $_ : ()} @f;
38 @f = grep {$_ ne ','} @f;
40 # any thing after send?
41 return (1, $self->msg('e6')) if !@f;
42 return (1, $self->msg('e28')) unless $self->isregistered || uc $f[0] eq $main::myalias;
47 # first deal with copies
48 if ($f eq 'C' || $f eq 'CC' || $f eq 'COPY') {
50 if (@f && uc $f[0] eq 'RR') {
57 my $oref = DXMsg::get($m);
58 return (0, $self->msg('m4', $m)) unless $oref;
59 return (0, $self->msg('m16')) unless @f;
61 # separate copy to everyone listed
63 my $newcall = uc shift @f;
64 my $msgno = DXMsg::next_transno('Msgno');
65 my $newsubj = "CC: " . $oref->subject;
66 my $nref = DXMsg->alloc($msgno,
76 my $from = $oref->from;
78 my $date = cldate($oref->t);
79 my $time = ztime($oref->t);
80 my $buf = "Original from: $from To: $to Date: $date $time";
82 push @list, $oref->read_msg_body();
85 push @out, $self->msg('m2', $oref->msgno, $newcall);
92 # private / noprivate / rr
93 if ($notincalls && ($f eq 'B' || $f =~ /^NOP/oi)) {
94 $loc->{private} = '0';
95 } elsif ($notincalls && ($f eq 'P' || $f =~ /^PRI/oi)) {
97 } elsif ($notincalls && ($f eq 'RR')) {
99 } elsif ($f eq '<' && @f) { # this is bbs syntax for from call
100 $loc->{from} = uc shift @f;
101 } elsif (($f =~ /^[\@\.\#\$]$/ || $f eq '.#') && @f) { # this is bbs syntax, for send it 'to node'
103 } elsif ($f =~ /^\$/) { # this is bbs syntax for a bid
105 } elsif ($f =~ /^<(\S+)/) { # this is bbs syntax for from call
107 } elsif ($f =~ /^\$\S+/) { # this is bbs syntax for bid
116 # is this callsign a distro?
117 # but be careful about messages to 'sysop'
118 if ($self->priv < 5 && $f eq 'SYSOP') {
119 push @to, $main::myalias;
122 my $fn = "/spider/msg/distro/$f.pl";
124 my $fh = new IO::File $fn;
131 return (1, "Error in Distro $f.pl:", $@) if $@;
140 if (($loc->{private} && is_callsign($f)) || (!$loc->{private} && DXMsg::valid_bull_addr($f))) {
141 if (grep $_ eq $f, @DXMsg::badmsg) {
142 push @out, $self->msg('m3', $f);
147 push @out, $self->msg('m3', $f);
152 # check we have some callsigns
157 return (1, @out, $self->msg('e6'));
159 $loc->{from} ||= $self->call;
160 unless (is_callsign($loc->{from})) {
162 return (1, $self->msg('e22', $loc->{from}));
165 # find me and set the state and the function on my state variable to
166 # keep calling me for every line until I relinquish control
167 $self->func("DXMsg::do_send_stuff");
168 $self->state('send1');
169 push @out, $self->msg('m1');
171 push @out, $self->msg('m17', $self->state);